Starting bundle processing
This commit is contained in:
parent
352db3cc75
commit
79a48611df
|
@ -1,31 +1,40 @@
|
|||
package ca.uhn.fhir.model.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class Bundle {
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
|
||||
private String myAuthorDevice;
|
||||
private String myAuthorName;
|
||||
public class Bundle implements IElement {
|
||||
|
||||
private StringDt myAuthorDevice;
|
||||
private StringDt myAuthorName;
|
||||
private List<BundleEntry> myEntries;
|
||||
private String myId;
|
||||
private String myLinkBase;
|
||||
private String myLinkFirst;
|
||||
private String myLinkLast;
|
||||
private String myLinkNext;
|
||||
private String myLinkPrevious;
|
||||
private String myLinkSelf;
|
||||
private Date myPublished;
|
||||
private String myTitle;
|
||||
private Integer myTotalResults;
|
||||
private Date myUpdated;
|
||||
private StringDt myId;
|
||||
private StringDt myLinkBase;
|
||||
private StringDt myLinkFirst;
|
||||
private StringDt myLinkLast;
|
||||
private StringDt myLinkNext;
|
||||
private StringDt myLinkPrevious;
|
||||
private StringDt myLinkSelf;
|
||||
private InstantDt myPublished;
|
||||
private StringDt myTitle;
|
||||
private IntegerDt myTotalResults;
|
||||
private InstantDt myUpdated;
|
||||
|
||||
public String getAuthorDevice() {
|
||||
public StringDt getAuthorDevice() {
|
||||
if (myAuthorDevice == null) {
|
||||
myAuthorDevice = new StringDt();
|
||||
}
|
||||
return myAuthorDevice;
|
||||
}
|
||||
|
||||
public String getAuthorName() {
|
||||
public StringDt getAuthorName() {
|
||||
if (myAuthorName == null) {
|
||||
myAuthorName = new StringDt();
|
||||
}
|
||||
return myAuthorName;
|
||||
}
|
||||
|
||||
|
@ -36,100 +45,83 @@ public class Bundle {
|
|||
return myEntries;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
public StringDt getId() {
|
||||
if (myId == null) {
|
||||
myId = new StringDt();
|
||||
}
|
||||
return myId;
|
||||
}
|
||||
|
||||
public String getLinkBase() {
|
||||
public StringDt getLinkBase() {
|
||||
if (myLinkBase == null) {
|
||||
myLinkBase = new StringDt();
|
||||
}
|
||||
return myLinkBase;
|
||||
}
|
||||
|
||||
public String getLinkFirst() {
|
||||
public StringDt getLinkFirst() {
|
||||
if (myLinkFirst == null) {
|
||||
myLinkFirst = new StringDt();
|
||||
}
|
||||
return myLinkFirst;
|
||||
}
|
||||
|
||||
public String getLinkLast() {
|
||||
public StringDt getLinkLast() {
|
||||
if (myLinkLast == null) {
|
||||
myLinkLast = new StringDt();
|
||||
}
|
||||
return myLinkLast;
|
||||
}
|
||||
|
||||
public String getLinkNext() {
|
||||
public StringDt getLinkNext() {
|
||||
if (myLinkNext == null) {
|
||||
myLinkNext = new StringDt();
|
||||
}
|
||||
return myLinkNext;
|
||||
}
|
||||
|
||||
public String getLinkPrevious() {
|
||||
public StringDt getLinkPrevious() {
|
||||
if (myLinkPrevious == null) {
|
||||
myLinkPrevious = new StringDt();
|
||||
}
|
||||
return myLinkPrevious;
|
||||
}
|
||||
|
||||
public String getLinkSelf() {
|
||||
public StringDt getLinkSelf() {
|
||||
if (myLinkSelf == null) {
|
||||
myLinkSelf = new StringDt();
|
||||
}
|
||||
return myLinkSelf;
|
||||
}
|
||||
|
||||
public Date getPublished() {
|
||||
public InstantDt getPublished() {
|
||||
if (myPublished == null) {
|
||||
myPublished = new InstantDt();
|
||||
}
|
||||
return myPublished;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
public StringDt getTitle() {
|
||||
if (myTitle == null) {
|
||||
myTitle= new StringDt();
|
||||
}
|
||||
return myTitle;
|
||||
}
|
||||
|
||||
public Integer getTotalResults() {
|
||||
public IntegerDt getTotalResults() {
|
||||
if (myTotalResults== null) {
|
||||
myTotalResults= new IntegerDt();
|
||||
}
|
||||
return myTotalResults;
|
||||
}
|
||||
|
||||
public Date getUpdated() {
|
||||
public InstantDt getUpdated() {
|
||||
if (myUpdated == null) {
|
||||
myUpdated= new InstantDt();
|
||||
}
|
||||
return myUpdated;
|
||||
}
|
||||
|
||||
public void setAuthorDevice(String theAuthorDevice) {
|
||||
myAuthorDevice = theAuthorDevice;
|
||||
}
|
||||
|
||||
public void setAuthorName(String theAuthorName) {
|
||||
myAuthorName = theAuthorName;
|
||||
}
|
||||
|
||||
public void setId(String theId) {
|
||||
myId = theId;
|
||||
}
|
||||
|
||||
public void setLinkBase(String theLinkBase) {
|
||||
myLinkBase = theLinkBase;
|
||||
}
|
||||
|
||||
public void setLinkFirst(String theLinkFirst) {
|
||||
myLinkFirst = theLinkFirst;
|
||||
}
|
||||
|
||||
public void setLinkLast(String theLinkLast) {
|
||||
myLinkLast = theLinkLast;
|
||||
}
|
||||
|
||||
public void setLinkNext(String theLinkNext) {
|
||||
myLinkNext = theLinkNext;
|
||||
}
|
||||
|
||||
public void setLinkPrevious(String theLinkPrevious) {
|
||||
myLinkPrevious = theLinkPrevious;
|
||||
}
|
||||
|
||||
public void setLinkSelf(String theLinkSelf) {
|
||||
myLinkSelf = theLinkSelf;
|
||||
}
|
||||
|
||||
public void setPublished(Date thePublished) {
|
||||
myPublished = thePublished;
|
||||
}
|
||||
|
||||
public void setTitle(String theTitle) {
|
||||
myTitle = theTitle;
|
||||
}
|
||||
|
||||
public void setTotalResults(Integer theTotalResults) {
|
||||
myTotalResults = theTotalResults;
|
||||
}
|
||||
|
||||
public void setUpdated(Date theUpdated) {
|
||||
myUpdated = theUpdated;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,12 +5,12 @@ import java.lang.annotation.Retention;
|
|||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value= {ElementType.FIELD})
|
||||
public @interface Choice {
|
||||
|
||||
Class<? extends IDatatype>[] types() default {};
|
||||
Class<? extends IElement>[] types() default {};
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package ca.uhn.fhir.model.dstu.composite;
|
||||
|
||||
import java.util.*;
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package ca.uhn.fhir.model.dstu.composite;
|
||||
|
||||
import java.util.*;
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package ca.uhn.fhir.model.dstu.composite;
|
||||
|
||||
import java.util.*;
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package ca.uhn.fhir.model.dstu.composite;
|
||||
|
||||
import java.util.*;
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package ca.uhn.fhir.model.dstu.composite;
|
||||
|
||||
import java.util.*;
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package ca.uhn.fhir.model.dstu.resource;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -530,5 +534,4 @@ public class Device implements IResource {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -10,6 +10,10 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package ca.uhn.fhir.model.dstu.resource;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -314,7 +318,6 @@ public class Group implements IResource {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Block class for child element: <b>Group.characteristic</b> (Trait of group members)
|
||||
*
|
||||
|
@ -325,135 +328,29 @@ public class Group implements IResource {
|
|||
*/
|
||||
@Block(name="Group.characteristic")
|
||||
public static class Characteristic implements IResourceBlock {
|
||||
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=1)
|
||||
private IdentifierDt myIdentifier;
|
||||
|
||||
@Child(name="type", type=CodeDt.class, order=1, min=1, max=1)
|
||||
private CodeDt myType;
|
||||
|
||||
@Child(name="actual", type=BooleanDt.class, order=2, min=1, max=1)
|
||||
private BooleanDt myActual;
|
||||
|
||||
@Child(name="code", type=CodeableConceptDt.class, order=3, min=0, max=1)
|
||||
@Child(name="code", type=CodeableConceptDt.class, order=0, min=1, max=1)
|
||||
private CodeableConceptDt myCode;
|
||||
|
||||
@Child(name="name", type=StringDt.class, order=4, min=0, max=1)
|
||||
private StringDt myName;
|
||||
@Child(name="value", order=1, min=1, max=1, choice=@Choice(types= {
|
||||
CodeableConceptDt.class,
|
||||
BooleanDt.class,
|
||||
QuantityDt.class,
|
||||
RangeDt.class,
|
||||
}))
|
||||
private IDatatype myValue;
|
||||
|
||||
@Child(name="quantity", type=IntegerDt.class, order=5, min=0, max=1)
|
||||
private IntegerDt myQuantity;
|
||||
|
||||
@Child(name="characteristic", order=6, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<Characteristic> myCharacteristic;
|
||||
|
||||
@Child(name="member", order=7, min=0, max=Child.MAX_UNLIMITED)
|
||||
@ChildResource(types= {
|
||||
Patient.class,
|
||||
Practitioner.class,
|
||||
Device.class,
|
||||
Medication.class,
|
||||
Substance.class,
|
||||
})
|
||||
private List<ResourceReference> myMember;
|
||||
@Child(name="exclude", type=BooleanDt.class, order=2, min=1, max=1)
|
||||
private BooleanDt myExclude;
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>identifier</b> (Unique id).
|
||||
* Gets the value(s) for <b>code</b> (Kind of characteristic).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A unique business identifier for this group
|
||||
* </p>
|
||||
*/
|
||||
public IdentifierDt getIdentifier() {
|
||||
if (myIdentifier == null) {
|
||||
myIdentifier = new IdentifierDt();
|
||||
}
|
||||
return myIdentifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>identifier</b> (Unique id)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A unique business identifier for this group
|
||||
* </p>
|
||||
*/
|
||||
public void setIdentifier(IdentifierDt theValue) {
|
||||
myIdentifier = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>type</b> (person | animal | practitioner | device | medication | substance).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Identifies the broad classification of the kind of resources the group includes
|
||||
* </p>
|
||||
*/
|
||||
public CodeDt getType() {
|
||||
if (myType == null) {
|
||||
myType = new CodeDt();
|
||||
}
|
||||
return myType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>type</b> (person | animal | practitioner | device | medication | substance)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Identifies the broad classification of the kind of resources the group includes
|
||||
* </p>
|
||||
*/
|
||||
public void setType(CodeDt theValue) {
|
||||
myType = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>actual</b> (Descriptive or actual).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* If true, indicates that the resource refers to a specific group of real individuals. If false, the group defines a set of intended individuals
|
||||
* </p>
|
||||
*/
|
||||
public BooleanDt getActual() {
|
||||
if (myActual == null) {
|
||||
myActual = new BooleanDt();
|
||||
}
|
||||
return myActual;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>actual</b> (Descriptive or actual)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* If true, indicates that the resource refers to a specific group of real individuals. If false, the group defines a set of intended individuals
|
||||
* </p>
|
||||
*/
|
||||
public void setActual(BooleanDt theValue) {
|
||||
myActual = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>code</b> (Kind of Group members).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Provides a specific type of resource the group includes. E.g. "cow", "syringe", etc.
|
||||
* A code that identifies the kind of trait being asserted
|
||||
* </p>
|
||||
*/
|
||||
public CodeableConceptDt getCode() {
|
||||
|
@ -464,11 +361,11 @@ public class Group implements IResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>code</b> (Kind of Group members)
|
||||
* Sets the value(s) for <b>code</b> (Kind of characteristic)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Provides a specific type of resource the group includes. E.g. "cow", "syringe", etc.
|
||||
* A code that identifies the kind of trait being asserted
|
||||
* </p>
|
||||
*/
|
||||
public void setCode(CodeableConceptDt theValue) {
|
||||
|
@ -477,134 +374,65 @@ public class Group implements IResource {
|
|||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>name</b> (Label for Group).
|
||||
* Gets the value(s) for <b>value[x]</b> (Value held by characteristic).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A label assigned to the group for human identification and communication
|
||||
* The value of the trait that holds (or does not hold - see 'exclude') for members of the group
|
||||
* </p>
|
||||
*/
|
||||
public StringDt getName() {
|
||||
if (myName == null) {
|
||||
myName = new StringDt();
|
||||
public IDatatype getValue() {
|
||||
return myValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>value[x]</b> (Value held by characteristic)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The value of the trait that holds (or does not hold - see 'exclude') for members of the group
|
||||
* </p>
|
||||
*/
|
||||
public void setValue(IDatatype theValue) {
|
||||
myValue = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>exclude</b> (Group includes or excludes).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* If true, indicates the characteristic is one that is NOT held by members of the group
|
||||
* </p>
|
||||
*/
|
||||
public BooleanDt getExclude() {
|
||||
if (myExclude == null) {
|
||||
myExclude = new BooleanDt();
|
||||
}
|
||||
return myName;
|
||||
return myExclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>name</b> (Label for Group)
|
||||
* Sets the value(s) for <b>exclude</b> (Group includes or excludes)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A label assigned to the group for human identification and communication
|
||||
* If true, indicates the characteristic is one that is NOT held by members of the group
|
||||
* </p>
|
||||
*/
|
||||
public void setName(StringDt theValue) {
|
||||
myName = theValue;
|
||||
public void setExclude(BooleanDt theValue) {
|
||||
myExclude = theValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>name</b> (Label for Group)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A label assigned to the group for human identification and communication
|
||||
* </p>
|
||||
*/
|
||||
public void setName( String theString) {
|
||||
myName = new StringDt(theString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>quantity</b> (Number of members).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A count of the number of resource instances that are part of the group
|
||||
* </p>
|
||||
*/
|
||||
public IntegerDt getQuantity() {
|
||||
if (myQuantity == null) {
|
||||
myQuantity = new IntegerDt();
|
||||
}
|
||||
return myQuantity;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>quantity</b> (Number of members)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A count of the number of resource instances that are part of the group
|
||||
* </p>
|
||||
*/
|
||||
public void setQuantity(IntegerDt theValue) {
|
||||
myQuantity = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>characteristic</b> (Trait of group members).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Identifies the traits shared by members of the group
|
||||
* </p>
|
||||
*/
|
||||
public List<Characteristic> getCharacteristic() {
|
||||
if (myCharacteristic == null) {
|
||||
myCharacteristic = new ArrayList<Characteristic>();
|
||||
}
|
||||
return myCharacteristic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>characteristic</b> (Trait of group members)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Identifies the traits shared by members of the group
|
||||
* </p>
|
||||
*/
|
||||
public void setCharacteristic(List<Characteristic> theValue) {
|
||||
myCharacteristic = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>member</b> (Who is in group).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Identifies the resource instances that are members of the group.
|
||||
* </p>
|
||||
*/
|
||||
public List<ResourceReference> getMember() {
|
||||
return myMember;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>member</b> (Who is in group)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Identifies the resource instances that are members of the group.
|
||||
* </p>
|
||||
*/
|
||||
public void setMember(List<ResourceReference> theValue) {
|
||||
myMember = theValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package ca.uhn.fhir.model.dstu.resource;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -459,7 +463,6 @@ public class Location implements IResource {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Block class for child element: <b>Location.position</b> (The absolute geographic location )
|
||||
*
|
||||
|
@ -470,431 +473,109 @@ public class Location implements IResource {
|
|||
*/
|
||||
@Block(name="Location.position")
|
||||
public static class Position implements IResourceBlock {
|
||||
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=1)
|
||||
private IdentifierDt myIdentifier;
|
||||
|
||||
@Child(name="name", type=StringDt.class, order=1, min=0, max=1)
|
||||
private StringDt myName;
|
||||
@Child(name="longitude", type=DecimalDt.class, order=0, min=1, max=1)
|
||||
private DecimalDt myLongitude;
|
||||
|
||||
@Child(name="description", type=StringDt.class, order=2, min=0, max=1)
|
||||
private StringDt myDescription;
|
||||
@Child(name="latitude", type=DecimalDt.class, order=1, min=1, max=1)
|
||||
private DecimalDt myLatitude;
|
||||
|
||||
@Child(name="type", type=CodeableConceptDt.class, order=3, min=0, max=1)
|
||||
private CodeableConceptDt myType;
|
||||
|
||||
@Child(name="telecom", type=ContactDt.class, order=4, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<ContactDt> myTelecom;
|
||||
|
||||
@Child(name="address", type=AddressDt.class, order=5, min=0, max=1)
|
||||
private AddressDt myAddress;
|
||||
|
||||
@Child(name="physicalType", type=CodeableConceptDt.class, order=6, min=0, max=1)
|
||||
private CodeableConceptDt myPhysicalType;
|
||||
|
||||
@Child(name="position", order=7, min=0, max=1)
|
||||
private Position myPosition;
|
||||
|
||||
@Child(name="managingOrganization", order=8, min=0, max=1)
|
||||
@ChildResource(types= {
|
||||
Organization.class,
|
||||
})
|
||||
private ResourceReference myManagingOrganization;
|
||||
|
||||
@Child(name="status", type=CodeDt.class, order=9, min=0, max=1)
|
||||
private CodeDt myStatus;
|
||||
|
||||
@Child(name="partOf", order=10, min=0, max=1)
|
||||
@ChildResource(types= {
|
||||
Location.class,
|
||||
})
|
||||
private ResourceReference myPartOf;
|
||||
|
||||
@Child(name="mode", type=CodeDt.class, order=11, min=0, max=1)
|
||||
private CodeDt myMode;
|
||||
@Child(name="altitude", type=DecimalDt.class, order=2, min=0, max=1)
|
||||
private DecimalDt myAltitude;
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>identifier</b> (Unique code or number identifying the location to its users).
|
||||
* Gets the value(s) for <b>longitude</b> (Longitude as expressed in KML).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Unique code or number identifying the location to its users
|
||||
* Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below)
|
||||
* </p>
|
||||
*/
|
||||
public IdentifierDt getIdentifier() {
|
||||
if (myIdentifier == null) {
|
||||
myIdentifier = new IdentifierDt();
|
||||
public DecimalDt getLongitude() {
|
||||
if (myLongitude == null) {
|
||||
myLongitude = new DecimalDt();
|
||||
}
|
||||
return myIdentifier;
|
||||
return myLongitude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>identifier</b> (Unique code or number identifying the location to its users)
|
||||
* Sets the value(s) for <b>longitude</b> (Longitude as expressed in KML)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Unique code or number identifying the location to its users
|
||||
* Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below)
|
||||
* </p>
|
||||
*/
|
||||
public void setIdentifier(IdentifierDt theValue) {
|
||||
myIdentifier = theValue;
|
||||
public void setLongitude(DecimalDt theValue) {
|
||||
myLongitude = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>name</b> (Name of the location as used by humans).
|
||||
* Gets the value(s) for <b>latitude</b> (Latitude as expressed in KML).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Name of the location as used by humans. Does not need to be unique.
|
||||
* Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below)
|
||||
* </p>
|
||||
*/
|
||||
public StringDt getName() {
|
||||
if (myName == null) {
|
||||
myName = new StringDt();
|
||||
public DecimalDt getLatitude() {
|
||||
if (myLatitude == null) {
|
||||
myLatitude = new DecimalDt();
|
||||
}
|
||||
return myName;
|
||||
return myLatitude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>name</b> (Name of the location as used by humans)
|
||||
* Sets the value(s) for <b>latitude</b> (Latitude as expressed in KML)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Name of the location as used by humans. Does not need to be unique.
|
||||
* Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below)
|
||||
* </p>
|
||||
*/
|
||||
public void setName(StringDt theValue) {
|
||||
myName = theValue;
|
||||
public void setLatitude(DecimalDt theValue) {
|
||||
myLatitude = theValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>name</b> (Name of the location as used by humans)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Name of the location as used by humans. Does not need to be unique.
|
||||
* </p>
|
||||
*/
|
||||
public void setName( String theString) {
|
||||
myName = new StringDt(theString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>description</b> (Description of the Location, which helps in finding or referencing the place).
|
||||
* Gets the value(s) for <b>altitude</b> (Altitude as expressed in KML).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Description of the Location, which helps in finding or referencing the place
|
||||
* Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below)
|
||||
* </p>
|
||||
*/
|
||||
public StringDt getDescription() {
|
||||
if (myDescription == null) {
|
||||
myDescription = new StringDt();
|
||||
public DecimalDt getAltitude() {
|
||||
if (myAltitude == null) {
|
||||
myAltitude = new DecimalDt();
|
||||
}
|
||||
return myDescription;
|
||||
return myAltitude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>description</b> (Description of the Location, which helps in finding or referencing the place)
|
||||
* Sets the value(s) for <b>altitude</b> (Altitude as expressed in KML)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Description of the Location, which helps in finding or referencing the place
|
||||
* Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below)
|
||||
* </p>
|
||||
*/
|
||||
public void setDescription(StringDt theValue) {
|
||||
myDescription = theValue;
|
||||
public void setAltitude(DecimalDt theValue) {
|
||||
myAltitude = theValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>description</b> (Description of the Location, which helps in finding or referencing the place)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Description of the Location, which helps in finding or referencing the place
|
||||
* </p>
|
||||
*/
|
||||
public void setDescription( String theString) {
|
||||
myDescription = new StringDt(theString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>type</b> (Indicates the type of function performed at the location).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Indicates the type of function performed at the location
|
||||
* </p>
|
||||
*/
|
||||
public CodeableConceptDt getType() {
|
||||
if (myType == null) {
|
||||
myType = new CodeableConceptDt();
|
||||
}
|
||||
return myType;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>type</b> (Indicates the type of function performed at the location)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Indicates the type of function performed at the location
|
||||
* </p>
|
||||
*/
|
||||
public void setType(CodeableConceptDt theValue) {
|
||||
myType = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>telecom</b> (Contact details of the location).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites
|
||||
* </p>
|
||||
*/
|
||||
public List<ContactDt> getTelecom() {
|
||||
if (myTelecom == null) {
|
||||
myTelecom = new ArrayList<ContactDt>();
|
||||
}
|
||||
return myTelecom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>telecom</b> (Contact details of the location)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites
|
||||
* </p>
|
||||
*/
|
||||
public void setTelecom(List<ContactDt> theValue) {
|
||||
myTelecom = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>address</b> (Physical location).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public AddressDt getAddress() {
|
||||
if (myAddress == null) {
|
||||
myAddress = new AddressDt();
|
||||
}
|
||||
return myAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>address</b> (Physical location)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public void setAddress(AddressDt theValue) {
|
||||
myAddress = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>physicalType</b> (Physical form of the location).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Physical form of the location, e.g. building, room, vehicle, road
|
||||
* </p>
|
||||
*/
|
||||
public CodeableConceptDt getPhysicalType() {
|
||||
if (myPhysicalType == null) {
|
||||
myPhysicalType = new CodeableConceptDt();
|
||||
}
|
||||
return myPhysicalType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>physicalType</b> (Physical form of the location)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Physical form of the location, e.g. building, room, vehicle, road
|
||||
* </p>
|
||||
*/
|
||||
public void setPhysicalType(CodeableConceptDt theValue) {
|
||||
myPhysicalType = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>position</b> (The absolute geographic location ).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The absolute geographic location of the Location, expressed in a KML compatible manner (see notes below for KML)
|
||||
* </p>
|
||||
*/
|
||||
public Position getPosition() {
|
||||
if (myPosition == null) {
|
||||
myPosition = new Position();
|
||||
}
|
||||
return myPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>position</b> (The absolute geographic location )
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The absolute geographic location of the Location, expressed in a KML compatible manner (see notes below for KML)
|
||||
* </p>
|
||||
*/
|
||||
public void setPosition(Position theValue) {
|
||||
myPosition = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>managingOrganization</b> (The organization that is responsible for the provisioning and upkeep of the location).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public ResourceReference getManagingOrganization() {
|
||||
if (myManagingOrganization == null) {
|
||||
myManagingOrganization = new ResourceReference();
|
||||
}
|
||||
return myManagingOrganization;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>managingOrganization</b> (The organization that is responsible for the provisioning and upkeep of the location)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public void setManagingOrganization(ResourceReference theValue) {
|
||||
myManagingOrganization = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>status</b> (active | suspended | inactive).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public CodeDt getStatus() {
|
||||
if (myStatus == null) {
|
||||
myStatus = new CodeDt();
|
||||
}
|
||||
return myStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>status</b> (active | suspended | inactive)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public void setStatus(CodeDt theValue) {
|
||||
myStatus = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>partOf</b> (Another Location which this Location is physically part of).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public ResourceReference getPartOf() {
|
||||
if (myPartOf == null) {
|
||||
myPartOf = new ResourceReference();
|
||||
}
|
||||
return myPartOf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>partOf</b> (Another Location which this Location is physically part of)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public void setPartOf(ResourceReference theValue) {
|
||||
myPartOf = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>mode</b> (instance | kind).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Indicates whether a resource instance represents a specific location or a class of locations
|
||||
* </p>
|
||||
*/
|
||||
public CodeDt getMode() {
|
||||
if (myMode == null) {
|
||||
myMode = new CodeDt();
|
||||
}
|
||||
return myMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>mode</b> (instance | kind)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Indicates whether a resource instance represents a specific location or a class of locations
|
||||
* </p>
|
||||
*/
|
||||
public void setMode(CodeDt theValue) {
|
||||
myMode = theValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package ca.uhn.fhir.model.dstu.resource;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -280,7 +284,6 @@ public class Medication implements IResource {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Block class for child element: <b>Medication.product</b> (Administrable medication details)
|
||||
*
|
||||
|
@ -291,252 +294,158 @@ public class Medication implements IResource {
|
|||
*/
|
||||
@Block(name="Medication.product")
|
||||
public static class Product implements IResourceBlock {
|
||||
@Child(name="name", type=StringDt.class, order=0, min=0, max=1)
|
||||
private StringDt myName;
|
||||
|
||||
@Child(name="code", type=CodeableConceptDt.class, order=1, min=0, max=1)
|
||||
private CodeableConceptDt myCode;
|
||||
@Child(name="form", type=CodeableConceptDt.class, order=0, min=0, max=1)
|
||||
private CodeableConceptDt myForm;
|
||||
|
||||
@Child(name="isBrand", type=BooleanDt.class, order=2, min=0, max=1)
|
||||
private BooleanDt myIsBrand;
|
||||
@Child(name="ingredient", order=1, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<ProductIngredient> myIngredient;
|
||||
|
||||
@Child(name="manufacturer", order=3, min=0, max=1)
|
||||
/**
|
||||
* Gets the value(s) for <b>form</b> (powder | tablets | carton +).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Describes the form of the item. Powder; tables; carton
|
||||
* </p>
|
||||
*/
|
||||
public CodeableConceptDt getForm() {
|
||||
if (myForm == null) {
|
||||
myForm = new CodeableConceptDt();
|
||||
}
|
||||
return myForm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>form</b> (powder | tablets | carton +)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Describes the form of the item. Powder; tables; carton
|
||||
* </p>
|
||||
*/
|
||||
public void setForm(CodeableConceptDt theValue) {
|
||||
myForm = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>ingredient</b> (Active or inactive ingredient).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Identifies a particular constituent of interest in the product
|
||||
* </p>
|
||||
*/
|
||||
public List<ProductIngredient> getIngredient() {
|
||||
if (myIngredient == null) {
|
||||
myIngredient = new ArrayList<ProductIngredient>();
|
||||
}
|
||||
return myIngredient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>ingredient</b> (Active or inactive ingredient)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Identifies a particular constituent of interest in the product
|
||||
* </p>
|
||||
*/
|
||||
public void setIngredient(List<ProductIngredient> theValue) {
|
||||
myIngredient = theValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Block class for child element: <b>Medication.product.ingredient</b> (Active or inactive ingredient)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Identifies a particular constituent of interest in the product
|
||||
* </p>
|
||||
*/
|
||||
@Block(name="Medication.product.ingredient")
|
||||
public static class ProductIngredient implements IResourceBlock {
|
||||
|
||||
@Child(name="item", order=0, min=1, max=1)
|
||||
@ChildResource(types= {
|
||||
Organization.class,
|
||||
Substance.class,
|
||||
Medication.class,
|
||||
})
|
||||
private ResourceReference myManufacturer;
|
||||
private ResourceReference myItem;
|
||||
|
||||
@Child(name="kind", type=CodeDt.class, order=4, min=0, max=1)
|
||||
private CodeDt myKind;
|
||||
|
||||
@Child(name="product", order=5, min=0, max=1)
|
||||
private Product myProduct;
|
||||
|
||||
@Child(name="package", type=CodeDt.class, order=6, min=0, max=1)
|
||||
private CodeDt myPackage;
|
||||
@Child(name="amount", type=RatioDt.class, order=1, min=0, max=1)
|
||||
private RatioDt myAmount;
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>name</b> (Common / Commercial name).
|
||||
* Gets the value(s) for <b>item</b> (The product contained).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The common/commercial name of the medication absent information such as strength, form, etc. E.g. Acetaminophen, Tylenol 3, etc. The fully coordinated name is communicated as the display of Medication.code
|
||||
* The actual ingredient - either a substance (simple ingredient) or another medication
|
||||
* </p>
|
||||
*/
|
||||
public StringDt getName() {
|
||||
if (myName == null) {
|
||||
myName = new StringDt();
|
||||
}
|
||||
return myName;
|
||||
public ResourceReference getItem() {
|
||||
return myItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>name</b> (Common / Commercial name)
|
||||
* Sets the value(s) for <b>item</b> (The product contained)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The common/commercial name of the medication absent information such as strength, form, etc. E.g. Acetaminophen, Tylenol 3, etc. The fully coordinated name is communicated as the display of Medication.code
|
||||
* The actual ingredient - either a substance (simple ingredient) or another medication
|
||||
* </p>
|
||||
*/
|
||||
public void setName(StringDt theValue) {
|
||||
myName = theValue;
|
||||
public void setItem(ResourceReference theValue) {
|
||||
myItem = theValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>name</b> (Common / Commercial name)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The common/commercial name of the medication absent information such as strength, form, etc. E.g. Acetaminophen, Tylenol 3, etc. The fully coordinated name is communicated as the display of Medication.code
|
||||
* </p>
|
||||
*/
|
||||
public void setName( String theString) {
|
||||
myName = new StringDt(theString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>code</b> (Codes that identify this medication).
|
||||
* Gets the value(s) for <b>amount</b> (How much ingredient in product).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A code (or set of codes) that identify this medication. Usage note: This could be a standard drug code such as a drug regulator code, RxNorm code, SNOMED CT code, etc. It could also be a local formulary code, optionally with translations to the standard drug codes
|
||||
* Specifies how many (or how much) of the items there are in this Medication. E.g. 250 mg per tablet
|
||||
* </p>
|
||||
*/
|
||||
public CodeableConceptDt getCode() {
|
||||
if (myCode == null) {
|
||||
myCode = new CodeableConceptDt();
|
||||
public RatioDt getAmount() {
|
||||
if (myAmount == null) {
|
||||
myAmount = new RatioDt();
|
||||
}
|
||||
return myCode;
|
||||
return myAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>code</b> (Codes that identify this medication)
|
||||
* Sets the value(s) for <b>amount</b> (How much ingredient in product)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A code (or set of codes) that identify this medication. Usage note: This could be a standard drug code such as a drug regulator code, RxNorm code, SNOMED CT code, etc. It could also be a local formulary code, optionally with translations to the standard drug codes
|
||||
* Specifies how many (or how much) of the items there are in this Medication. E.g. 250 mg per tablet
|
||||
* </p>
|
||||
*/
|
||||
public void setCode(CodeableConceptDt theValue) {
|
||||
myCode = theValue;
|
||||
public void setAmount(RatioDt theValue) {
|
||||
myAmount = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>isBrand</b> (True if a brand).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Set to true if the item is attributable to a specific manufacturer (even if we don't know who that is)
|
||||
* </p>
|
||||
*/
|
||||
public BooleanDt getIsBrand() {
|
||||
if (myIsBrand == null) {
|
||||
myIsBrand = new BooleanDt();
|
||||
}
|
||||
return myIsBrand;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>isBrand</b> (True if a brand)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Set to true if the item is attributable to a specific manufacturer (even if we don't know who that is)
|
||||
* </p>
|
||||
*/
|
||||
public void setIsBrand(BooleanDt theValue) {
|
||||
myIsBrand = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>manufacturer</b> (Manufacturer of the item).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Describes the details of the manufacturer
|
||||
* </p>
|
||||
*/
|
||||
public ResourceReference getManufacturer() {
|
||||
if (myManufacturer == null) {
|
||||
myManufacturer = new ResourceReference();
|
||||
}
|
||||
return myManufacturer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>manufacturer</b> (Manufacturer of the item)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Describes the details of the manufacturer
|
||||
* </p>
|
||||
*/
|
||||
public void setManufacturer(ResourceReference theValue) {
|
||||
myManufacturer = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>kind</b> (product | package).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Medications are either a single administrable product or a package that contains one or more products.
|
||||
* </p>
|
||||
*/
|
||||
public CodeDt getKind() {
|
||||
if (myKind == null) {
|
||||
myKind = new CodeDt();
|
||||
}
|
||||
return myKind;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>kind</b> (product | package)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Medications are either a single administrable product or a package that contains one or more products.
|
||||
* </p>
|
||||
*/
|
||||
public void setKind(CodeDt theValue) {
|
||||
myKind = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>product</b> (Administrable medication details).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Information that only applies to products (not packages)
|
||||
* </p>
|
||||
*/
|
||||
public Product getProduct() {
|
||||
if (myProduct == null) {
|
||||
myProduct = new Product();
|
||||
}
|
||||
return myProduct;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>product</b> (Administrable medication details)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Information that only applies to products (not packages)
|
||||
* </p>
|
||||
*/
|
||||
public void setProduct(Product theValue) {
|
||||
myProduct = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>package</b> (Details about packaged medications).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Information that only applies to packages (not products)
|
||||
* </p>
|
||||
*/
|
||||
public CodeDt getPackage() {
|
||||
if (myPackage == null) {
|
||||
myPackage = new CodeDt();
|
||||
}
|
||||
return myPackage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>package</b> (Details about packaged medications)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Information that only applies to packages (not products)
|
||||
* </p>
|
||||
*/
|
||||
public void setPackage(CodeDt theValue) {
|
||||
myPackage = theValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,6 +10,10 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package ca.uhn.fhir.model.dstu.resource;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -349,7 +353,6 @@ public class Organization implements IResource {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Block class for child element: <b>Organization.contact</b> (Contact for the organization for a certain purpose)
|
||||
*
|
||||
|
@ -360,148 +363,90 @@ public class Organization implements IResource {
|
|||
*/
|
||||
@Block(name="Organization.contact")
|
||||
public static class Contact implements IResourceBlock {
|
||||
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<IdentifierDt> myIdentifier;
|
||||
|
||||
@Child(name="name", type=StringDt.class, order=1, min=0, max=1)
|
||||
private StringDt myName;
|
||||
@Child(name="purpose", type=CodeableConceptDt.class, order=0, min=0, max=1)
|
||||
private CodeableConceptDt myPurpose;
|
||||
|
||||
@Child(name="type", type=CodeableConceptDt.class, order=2, min=0, max=1)
|
||||
private CodeableConceptDt myType;
|
||||
@Child(name="name", type=HumanNameDt.class, order=1, min=0, max=1)
|
||||
private HumanNameDt myName;
|
||||
|
||||
@Child(name="telecom", type=ContactDt.class, order=3, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Child(name="telecom", type=ContactDt.class, order=2, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<ContactDt> myTelecom;
|
||||
|
||||
@Child(name="address", type=AddressDt.class, order=4, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<AddressDt> myAddress;
|
||||
@Child(name="address", type=AddressDt.class, order=3, min=0, max=1)
|
||||
private AddressDt myAddress;
|
||||
|
||||
@Child(name="partOf", order=5, min=0, max=1)
|
||||
@ChildResource(types= {
|
||||
Organization.class,
|
||||
})
|
||||
private ResourceReference myPartOf;
|
||||
|
||||
@Child(name="contact", order=6, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<Contact> myContact;
|
||||
|
||||
@Child(name="location", order=7, min=0, max=Child.MAX_UNLIMITED)
|
||||
@ChildResource(types= {
|
||||
Location.class,
|
||||
})
|
||||
private List<ResourceReference> myLocation;
|
||||
|
||||
@Child(name="active", type=BooleanDt.class, order=8, min=0, max=1)
|
||||
private BooleanDt myActive;
|
||||
@Child(name="gender", type=CodeableConceptDt.class, order=4, min=0, max=1)
|
||||
private CodeableConceptDt myGender;
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>identifier</b> (Identifies this organization across multiple systems).
|
||||
* Gets the value(s) for <b>purpose</b> (The type of contact).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Identifier for the organization that is used to identify the organization across multiple disparate systems
|
||||
* Indicates a purpose for which the contact can be reached
|
||||
* </p>
|
||||
*/
|
||||
public List<IdentifierDt> getIdentifier() {
|
||||
if (myIdentifier == null) {
|
||||
myIdentifier = new ArrayList<IdentifierDt>();
|
||||
public CodeableConceptDt getPurpose() {
|
||||
if (myPurpose == null) {
|
||||
myPurpose = new CodeableConceptDt();
|
||||
}
|
||||
return myIdentifier;
|
||||
return myPurpose;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>identifier</b> (Identifies this organization across multiple systems)
|
||||
* Sets the value(s) for <b>purpose</b> (The type of contact)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Identifier for the organization that is used to identify the organization across multiple disparate systems
|
||||
* Indicates a purpose for which the contact can be reached
|
||||
* </p>
|
||||
*/
|
||||
public void setIdentifier(List<IdentifierDt> theValue) {
|
||||
myIdentifier = theValue;
|
||||
public void setPurpose(CodeableConceptDt theValue) {
|
||||
myPurpose = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>name</b> (Name used for the organization).
|
||||
* Gets the value(s) for <b>name</b> (A name associated with the contact).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A name associated with the organization
|
||||
* A name associated with the contact
|
||||
* </p>
|
||||
*/
|
||||
public StringDt getName() {
|
||||
public HumanNameDt getName() {
|
||||
if (myName == null) {
|
||||
myName = new StringDt();
|
||||
myName = new HumanNameDt();
|
||||
}
|
||||
return myName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>name</b> (Name used for the organization)
|
||||
* Sets the value(s) for <b>name</b> (A name associated with the contact)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A name associated with the organization
|
||||
* A name associated with the contact
|
||||
* </p>
|
||||
*/
|
||||
public void setName(StringDt theValue) {
|
||||
public void setName(HumanNameDt theValue) {
|
||||
myName = theValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>name</b> (Name used for the organization)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A name associated with the organization
|
||||
* </p>
|
||||
*/
|
||||
public void setName( String theString) {
|
||||
myName = new StringDt(theString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>type</b> (Kind of organization).
|
||||
* Gets the value(s) for <b>telecom</b> (Contact details (telephone, email, etc) for a contact).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The kind of organization that this is
|
||||
* </p>
|
||||
*/
|
||||
public CodeableConceptDt getType() {
|
||||
if (myType == null) {
|
||||
myType = new CodeableConceptDt();
|
||||
}
|
||||
return myType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>type</b> (Kind of organization)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The kind of organization that this is
|
||||
* </p>
|
||||
*/
|
||||
public void setType(CodeableConceptDt theValue) {
|
||||
myType = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>telecom</b> (A contact detail for the organization).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A contact detail for the organization
|
||||
* A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.
|
||||
* </p>
|
||||
*/
|
||||
public List<ContactDt> getTelecom() {
|
||||
|
@ -512,11 +457,11 @@ public class Organization implements IResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>telecom</b> (A contact detail for the organization)
|
||||
* Sets the value(s) for <b>telecom</b> (Contact details (telephone, email, etc) for a contact)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A contact detail for the organization
|
||||
* A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.
|
||||
* </p>
|
||||
*/
|
||||
public void setTelecom(List<ContactDt> theValue) {
|
||||
|
@ -525,156 +470,68 @@ public class Organization implements IResource {
|
|||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>address</b> (An address for the organization).
|
||||
* Gets the value(s) for <b>address</b> (Visiting or postal addresses for the contact).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* An address for the organization
|
||||
* Visiting or postal addresses for the contact
|
||||
* </p>
|
||||
*/
|
||||
public List<AddressDt> getAddress() {
|
||||
public AddressDt getAddress() {
|
||||
if (myAddress == null) {
|
||||
myAddress = new ArrayList<AddressDt>();
|
||||
myAddress = new AddressDt();
|
||||
}
|
||||
return myAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>address</b> (An address for the organization)
|
||||
* Sets the value(s) for <b>address</b> (Visiting or postal addresses for the contact)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* An address for the organization
|
||||
* Visiting or postal addresses for the contact
|
||||
* </p>
|
||||
*/
|
||||
public void setAddress(List<AddressDt> theValue) {
|
||||
public void setAddress(AddressDt theValue) {
|
||||
myAddress = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>partOf</b> (The organization of which this organization forms a part).
|
||||
* Gets the value(s) for <b>gender</b> (Gender for administrative purposes).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The organization of which this organization forms a part
|
||||
* Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
|
||||
* </p>
|
||||
*/
|
||||
public ResourceReference getPartOf() {
|
||||
if (myPartOf == null) {
|
||||
myPartOf = new ResourceReference();
|
||||
public CodeableConceptDt getGender() {
|
||||
if (myGender == null) {
|
||||
myGender = new CodeableConceptDt();
|
||||
}
|
||||
return myPartOf;
|
||||
return myGender;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>partOf</b> (The organization of which this organization forms a part)
|
||||
* Sets the value(s) for <b>gender</b> (Gender for administrative purposes)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The organization of which this organization forms a part
|
||||
* Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
|
||||
* </p>
|
||||
*/
|
||||
public void setPartOf(ResourceReference theValue) {
|
||||
myPartOf = theValue;
|
||||
public void setGender(CodeableConceptDt theValue) {
|
||||
myGender = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>contact</b> (Contact for the organization for a certain purpose).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public List<Contact> getContact() {
|
||||
if (myContact == null) {
|
||||
myContact = new ArrayList<Contact>();
|
||||
}
|
||||
return myContact;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>contact</b> (Contact for the organization for a certain purpose)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public void setContact(List<Contact> theValue) {
|
||||
myContact = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>location</b> (Location(s) the organization uses to provide services).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Location(s) the organization uses to provide services
|
||||
* </p>
|
||||
*/
|
||||
public List<ResourceReference> getLocation() {
|
||||
if (myLocation == null) {
|
||||
myLocation = new ArrayList<ResourceReference>();
|
||||
}
|
||||
return myLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>location</b> (Location(s) the organization uses to provide services)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Location(s) the organization uses to provide services
|
||||
* </p>
|
||||
*/
|
||||
public void setLocation(List<ResourceReference> theValue) {
|
||||
myLocation = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>active</b> (Whether the organization's record is still in active use).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Whether the organization's record is still in active use
|
||||
* </p>
|
||||
*/
|
||||
public BooleanDt getActive() {
|
||||
if (myActive == null) {
|
||||
myActive = new BooleanDt();
|
||||
}
|
||||
return myActive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>active</b> (Whether the organization's record is still in active use)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Whether the organization's record is still in active use
|
||||
* </p>
|
||||
*/
|
||||
public void setActive(BooleanDt theValue) {
|
||||
myActive = theValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,6 +10,10 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package ca.uhn.fhir.model.dstu.resource;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -514,7 +518,6 @@ public class Practitioner implements IResource {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Block class for child element: <b>Practitioner.qualification</b> (Qualifications obtained by training and certification)
|
||||
*
|
||||
|
@ -525,373 +528,57 @@ public class Practitioner implements IResource {
|
|||
*/
|
||||
@Block(name="Practitioner.qualification")
|
||||
public static class Qualification implements IResourceBlock {
|
||||
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<IdentifierDt> myIdentifier;
|
||||
|
||||
@Child(name="name", type=HumanNameDt.class, order=1, min=0, max=1)
|
||||
private HumanNameDt myName;
|
||||
@Child(name="code", type=CodeableConceptDt.class, order=0, min=1, max=1)
|
||||
private CodeableConceptDt myCode;
|
||||
|
||||
@Child(name="telecom", type=ContactDt.class, order=2, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<ContactDt> myTelecom;
|
||||
@Child(name="period", type=PeriodDt.class, order=1, min=0, max=1)
|
||||
private PeriodDt myPeriod;
|
||||
|
||||
@Child(name="address", type=AddressDt.class, order=3, min=0, max=1)
|
||||
private AddressDt myAddress;
|
||||
|
||||
@Child(name="gender", type=CodeableConceptDt.class, order=4, min=0, max=1)
|
||||
private CodeableConceptDt myGender;
|
||||
|
||||
@Child(name="birthDate", type=DateTimeDt.class, order=5, min=0, max=1)
|
||||
private DateTimeDt myBirthDate;
|
||||
|
||||
@Child(name="photo", type=AttachmentDt.class, order=6, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<AttachmentDt> myPhoto;
|
||||
|
||||
@Child(name="organization", order=7, min=0, max=1)
|
||||
@Child(name="issuer", order=2, min=0, max=1)
|
||||
@ChildResource(types= {
|
||||
Organization.class,
|
||||
})
|
||||
private ResourceReference myOrganization;
|
||||
|
||||
@Child(name="role", type=CodeableConceptDt.class, order=8, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<CodeableConceptDt> myRole;
|
||||
|
||||
@Child(name="specialty", type=CodeableConceptDt.class, order=9, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<CodeableConceptDt> mySpecialty;
|
||||
|
||||
@Child(name="period", type=PeriodDt.class, order=10, min=0, max=1)
|
||||
private PeriodDt myPeriod;
|
||||
|
||||
@Child(name="location", order=11, min=0, max=Child.MAX_UNLIMITED)
|
||||
@ChildResource(types= {
|
||||
Location.class,
|
||||
})
|
||||
private List<ResourceReference> myLocation;
|
||||
|
||||
@Child(name="qualification", order=12, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<Qualification> myQualification;
|
||||
|
||||
@Child(name="communication", type=CodeableConceptDt.class, order=13, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<CodeableConceptDt> myCommunication;
|
||||
private ResourceReference myIssuer;
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>identifier</b> (A identifier for the person as this agent).
|
||||
* Gets the value(s) for <b>code</b> (Coded representation of the qualification).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* An identifier that applies to this person in this role
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public List<IdentifierDt> getIdentifier() {
|
||||
if (myIdentifier == null) {
|
||||
myIdentifier = new ArrayList<IdentifierDt>();
|
||||
public CodeableConceptDt getCode() {
|
||||
if (myCode == null) {
|
||||
myCode = new CodeableConceptDt();
|
||||
}
|
||||
return myIdentifier;
|
||||
return myCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>identifier</b> (A identifier for the person as this agent)
|
||||
* Sets the value(s) for <b>code</b> (Coded representation of the qualification)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* An identifier that applies to this person in this role
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public void setIdentifier(List<IdentifierDt> theValue) {
|
||||
myIdentifier = theValue;
|
||||
public void setCode(CodeableConceptDt theValue) {
|
||||
myCode = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>name</b> (A name associated with the person).
|
||||
* Gets the value(s) for <b>period</b> (Period during which the qualification is valid).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A name associated with the person
|
||||
* </p>
|
||||
*/
|
||||
public HumanNameDt getName() {
|
||||
if (myName == null) {
|
||||
myName = new HumanNameDt();
|
||||
}
|
||||
return myName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>name</b> (A name associated with the person)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A name associated with the person
|
||||
* </p>
|
||||
*/
|
||||
public void setName(HumanNameDt theValue) {
|
||||
myName = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>telecom</b> (A contact detail for the practitioner).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A contact detail for the practitioner, e.g. a telephone number or an email address.
|
||||
* </p>
|
||||
*/
|
||||
public List<ContactDt> getTelecom() {
|
||||
if (myTelecom == null) {
|
||||
myTelecom = new ArrayList<ContactDt>();
|
||||
}
|
||||
return myTelecom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>telecom</b> (A contact detail for the practitioner)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A contact detail for the practitioner, e.g. a telephone number or an email address.
|
||||
* </p>
|
||||
*/
|
||||
public void setTelecom(List<ContactDt> theValue) {
|
||||
myTelecom = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>address</b> (Where practitioner can be found/visited).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The postal address where the practitioner can be found or visited or to which mail can be delivered
|
||||
* </p>
|
||||
*/
|
||||
public AddressDt getAddress() {
|
||||
if (myAddress == null) {
|
||||
myAddress = new AddressDt();
|
||||
}
|
||||
return myAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>address</b> (Where practitioner can be found/visited)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The postal address where the practitioner can be found or visited or to which mail can be delivered
|
||||
* </p>
|
||||
*/
|
||||
public void setAddress(AddressDt theValue) {
|
||||
myAddress = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>gender</b> (Gender for administrative purposes).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
|
||||
* </p>
|
||||
*/
|
||||
public CodeableConceptDt getGender() {
|
||||
if (myGender == null) {
|
||||
myGender = new CodeableConceptDt();
|
||||
}
|
||||
return myGender;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>gender</b> (Gender for administrative purposes)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
|
||||
* </p>
|
||||
*/
|
||||
public void setGender(CodeableConceptDt theValue) {
|
||||
myGender = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>birthDate</b> (The date and time of birth for the practitioner).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The date and time of birth for the practitioner
|
||||
* </p>
|
||||
*/
|
||||
public DateTimeDt getBirthDate() {
|
||||
if (myBirthDate == null) {
|
||||
myBirthDate = new DateTimeDt();
|
||||
}
|
||||
return myBirthDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>birthDate</b> (The date and time of birth for the practitioner)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The date and time of birth for the practitioner
|
||||
* </p>
|
||||
*/
|
||||
public void setBirthDate(DateTimeDt theValue) {
|
||||
myBirthDate = theValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>birthDate</b> (The date and time of birth for the practitioner)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The date and time of birth for the practitioner
|
||||
* </p>
|
||||
*/
|
||||
public void setBirthDateWithSecondsPrecision( Date theDate) {
|
||||
myBirthDate = new DateTimeDt(theDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>photo</b> (Image of the person).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Image of the person
|
||||
* </p>
|
||||
*/
|
||||
public List<AttachmentDt> getPhoto() {
|
||||
if (myPhoto == null) {
|
||||
myPhoto = new ArrayList<AttachmentDt>();
|
||||
}
|
||||
return myPhoto;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>photo</b> (Image of the person)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Image of the person
|
||||
* </p>
|
||||
*/
|
||||
public void setPhoto(List<AttachmentDt> theValue) {
|
||||
myPhoto = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>organization</b> (The represented organization).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The organization that the practitioner represents
|
||||
* </p>
|
||||
*/
|
||||
public ResourceReference getOrganization() {
|
||||
if (myOrganization == null) {
|
||||
myOrganization = new ResourceReference();
|
||||
}
|
||||
return myOrganization;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>organization</b> (The represented organization)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The organization that the practitioner represents
|
||||
* </p>
|
||||
*/
|
||||
public void setOrganization(ResourceReference theValue) {
|
||||
myOrganization = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>role</b> (Roles which this practitioner may perform).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Roles which this practitioner is authorized to perform for the organization
|
||||
* </p>
|
||||
*/
|
||||
public List<CodeableConceptDt> getRole() {
|
||||
if (myRole == null) {
|
||||
myRole = new ArrayList<CodeableConceptDt>();
|
||||
}
|
||||
return myRole;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>role</b> (Roles which this practitioner may perform)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Roles which this practitioner is authorized to perform for the organization
|
||||
* </p>
|
||||
*/
|
||||
public void setRole(List<CodeableConceptDt> theValue) {
|
||||
myRole = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>specialty</b> (Specific specialty of the practitioner).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Specific specialty of the practitioner
|
||||
* </p>
|
||||
*/
|
||||
public List<CodeableConceptDt> getSpecialty() {
|
||||
if (mySpecialty == null) {
|
||||
mySpecialty = new ArrayList<CodeableConceptDt>();
|
||||
}
|
||||
return mySpecialty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>specialty</b> (Specific specialty of the practitioner)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Specific specialty of the practitioner
|
||||
* </p>
|
||||
*/
|
||||
public void setSpecialty(List<CodeableConceptDt> theValue) {
|
||||
mySpecialty = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>period</b> (The period during which the practitioner is authorized to perform in these role(s)).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The period during which the person is authorized to act as a practitioner in these role(s) for the organization
|
||||
* Period during which the qualification is valid
|
||||
* </p>
|
||||
*/
|
||||
public PeriodDt getPeriod() {
|
||||
|
@ -902,11 +589,11 @@ public class Practitioner implements IResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>period</b> (The period during which the practitioner is authorized to perform in these role(s))
|
||||
* Sets the value(s) for <b>period</b> (Period during which the qualification is valid)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The period during which the person is authorized to act as a practitioner in these role(s) for the organization
|
||||
* Period during which the qualification is valid
|
||||
* </p>
|
||||
*/
|
||||
public void setPeriod(PeriodDt theValue) {
|
||||
|
@ -915,96 +602,38 @@ public class Practitioner implements IResource {
|
|||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>location</b> (The location(s) at which this practitioner provides care).
|
||||
* Gets the value(s) for <b>issuer</b> (Organization that regulates and issues the qualification).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The location(s) at which this practitioner provides care
|
||||
* Organization that regulates and issues the qualification
|
||||
* </p>
|
||||
*/
|
||||
public List<ResourceReference> getLocation() {
|
||||
if (myLocation == null) {
|
||||
myLocation = new ArrayList<ResourceReference>();
|
||||
public ResourceReference getIssuer() {
|
||||
if (myIssuer == null) {
|
||||
myIssuer = new ResourceReference();
|
||||
}
|
||||
return myLocation;
|
||||
return myIssuer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>location</b> (The location(s) at which this practitioner provides care)
|
||||
* Sets the value(s) for <b>issuer</b> (Organization that regulates and issues the qualification)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* The location(s) at which this practitioner provides care
|
||||
* Organization that regulates and issues the qualification
|
||||
* </p>
|
||||
*/
|
||||
public void setLocation(List<ResourceReference> theValue) {
|
||||
myLocation = theValue;
|
||||
public void setIssuer(ResourceReference theValue) {
|
||||
myIssuer = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>qualification</b> (Qualifications obtained by training and certification).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public List<Qualification> getQualification() {
|
||||
if (myQualification == null) {
|
||||
myQualification = new ArrayList<Qualification>();
|
||||
}
|
||||
return myQualification;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>qualification</b> (Qualifications obtained by training and certification)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public void setQualification(List<Qualification> theValue) {
|
||||
myQualification = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>communication</b> (A language the practitioner is able to use in patient communication).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A language the practitioner is able to use in patient communication
|
||||
* </p>
|
||||
*/
|
||||
public List<CodeableConceptDt> getCommunication() {
|
||||
if (myCommunication == null) {
|
||||
myCommunication = new ArrayList<CodeableConceptDt>();
|
||||
}
|
||||
return myCommunication;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>communication</b> (A language the practitioner is able to use in patient communication)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A language the practitioner is able to use in patient communication
|
||||
* </p>
|
||||
*/
|
||||
public void setCommunication(List<CodeableConceptDt> theValue) {
|
||||
myCommunication = theValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -10,6 +10,10 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package ca.uhn.fhir.model.dstu.resource;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -178,7 +182,6 @@ public class Substance implements IResource {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Block class for child element: <b>Substance.instance</b> (If this describes a specific package/container of the substance)
|
||||
*
|
||||
|
@ -189,150 +192,120 @@ public class Substance implements IResource {
|
|||
*/
|
||||
@Block(name="Substance.instance")
|
||||
public static class Instance implements IResourceBlock {
|
||||
@Child(name="type", type=CodeableConceptDt.class, order=0, min=1, max=1)
|
||||
private CodeableConceptDt myType;
|
||||
|
||||
@Child(name="description", type=StringDt.class, order=1, min=0, max=1)
|
||||
private StringDt myDescription;
|
||||
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=1)
|
||||
private IdentifierDt myIdentifier;
|
||||
|
||||
@Child(name="instance", order=2, min=0, max=1)
|
||||
private Instance myInstance;
|
||||
@Child(name="expiry", type=DateTimeDt.class, order=1, min=0, max=1)
|
||||
private DateTimeDt myExpiry;
|
||||
|
||||
@Child(name="ingredient", order=3, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<Ingredient> myIngredient;
|
||||
@Child(name="quantity", type=QuantityDt.class, order=2, min=0, max=1)
|
||||
private QuantityDt myQuantity;
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>type</b> (What kind of substance this is).
|
||||
* Gets the value(s) for <b>identifier</b> (Identifier of the package/container).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A code (or set of codes) that identify this substance
|
||||
* Identifier associated with the package/container (usually a label affixed directly)
|
||||
* </p>
|
||||
*/
|
||||
public CodeableConceptDt getType() {
|
||||
if (myType == null) {
|
||||
myType = new CodeableConceptDt();
|
||||
public IdentifierDt getIdentifier() {
|
||||
if (myIdentifier == null) {
|
||||
myIdentifier = new IdentifierDt();
|
||||
}
|
||||
return myType;
|
||||
return myIdentifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>type</b> (What kind of substance this is)
|
||||
* Sets the value(s) for <b>identifier</b> (Identifier of the package/container)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A code (or set of codes) that identify this substance
|
||||
* Identifier associated with the package/container (usually a label affixed directly)
|
||||
* </p>
|
||||
*/
|
||||
public void setType(CodeableConceptDt theValue) {
|
||||
myType = theValue;
|
||||
public void setIdentifier(IdentifierDt theValue) {
|
||||
myIdentifier = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>description</b> (Textual description of the substance, comments).
|
||||
* Gets the value(s) for <b>expiry</b> (When no longer valid to use).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A description of the substance - its appearance, handling requirements, and other usage notes
|
||||
* When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry.
|
||||
* </p>
|
||||
*/
|
||||
public StringDt getDescription() {
|
||||
if (myDescription == null) {
|
||||
myDescription = new StringDt();
|
||||
public DateTimeDt getExpiry() {
|
||||
if (myExpiry == null) {
|
||||
myExpiry = new DateTimeDt();
|
||||
}
|
||||
return myDescription;
|
||||
return myExpiry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>description</b> (Textual description of the substance, comments)
|
||||
* Sets the value(s) for <b>expiry</b> (When no longer valid to use)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A description of the substance - its appearance, handling requirements, and other usage notes
|
||||
* When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry.
|
||||
* </p>
|
||||
*/
|
||||
public void setDescription(StringDt theValue) {
|
||||
myDescription = theValue;
|
||||
public void setExpiry(DateTimeDt theValue) {
|
||||
myExpiry = theValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>description</b> (Textual description of the substance, comments)
|
||||
* Sets the value(s) for <b>expiry</b> (When no longer valid to use)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A description of the substance - its appearance, handling requirements, and other usage notes
|
||||
* When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry.
|
||||
* </p>
|
||||
*/
|
||||
public void setDescription( String theString) {
|
||||
myDescription = new StringDt(theString);
|
||||
public void setExpiryWithSecondsPrecision( Date theDate) {
|
||||
myExpiry = new DateTimeDt(theDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>instance</b> (If this describes a specific package/container of the substance).
|
||||
* Gets the value(s) for <b>quantity</b> (Amount of substance in the package).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance
|
||||
* The amount of the substance
|
||||
* </p>
|
||||
*/
|
||||
public Instance getInstance() {
|
||||
if (myInstance == null) {
|
||||
myInstance = new Instance();
|
||||
public QuantityDt getQuantity() {
|
||||
if (myQuantity == null) {
|
||||
myQuantity = new QuantityDt();
|
||||
}
|
||||
return myInstance;
|
||||
return myQuantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>instance</b> (If this describes a specific package/container of the substance)
|
||||
* Sets the value(s) for <b>quantity</b> (Amount of substance in the package)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance
|
||||
* The amount of the substance
|
||||
* </p>
|
||||
*/
|
||||
public void setInstance(Instance theValue) {
|
||||
myInstance = theValue;
|
||||
public void setQuantity(QuantityDt theValue) {
|
||||
myQuantity = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>ingredient</b> (Composition information about the substance).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A substance can be composed of other substances
|
||||
* </p>
|
||||
*/
|
||||
public List<Ingredient> getIngredient() {
|
||||
if (myIngredient == null) {
|
||||
myIngredient = new ArrayList<Ingredient>();
|
||||
}
|
||||
return myIngredient;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>ingredient</b> (Composition information about the substance)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A substance can be composed of other substances
|
||||
* </p>
|
||||
*/
|
||||
public void setIngredient(List<Ingredient> theValue) {
|
||||
myIngredient = theValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Block class for child element: <b>Substance.ingredient</b> (Composition information about the substance)
|
||||
|
@ -344,150 +317,79 @@ public class Substance implements IResource {
|
|||
*/
|
||||
@Block(name="Substance.ingredient")
|
||||
public static class Ingredient implements IResourceBlock {
|
||||
@Child(name="type", type=CodeableConceptDt.class, order=0, min=1, max=1)
|
||||
private CodeableConceptDt myType;
|
||||
|
||||
@Child(name="description", type=StringDt.class, order=1, min=0, max=1)
|
||||
private StringDt myDescription;
|
||||
@Child(name="quantity", type=RatioDt.class, order=0, min=0, max=1)
|
||||
private RatioDt myQuantity;
|
||||
|
||||
@Child(name="instance", order=2, min=0, max=1)
|
||||
private Instance myInstance;
|
||||
|
||||
@Child(name="ingredient", order=3, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<Ingredient> myIngredient;
|
||||
@Child(name="substance", order=1, min=1, max=1)
|
||||
@ChildResource(types= {
|
||||
Substance.class,
|
||||
})
|
||||
private ResourceReference mySubstance;
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>type</b> (What kind of substance this is).
|
||||
* Gets the value(s) for <b>quantity</b> (Optional amount (concentration)).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A code (or set of codes) that identify this substance
|
||||
* The amount of the ingredient in the substance - a concentration ratio
|
||||
* </p>
|
||||
*/
|
||||
public CodeableConceptDt getType() {
|
||||
if (myType == null) {
|
||||
myType = new CodeableConceptDt();
|
||||
public RatioDt getQuantity() {
|
||||
if (myQuantity == null) {
|
||||
myQuantity = new RatioDt();
|
||||
}
|
||||
return myType;
|
||||
return myQuantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>type</b> (What kind of substance this is)
|
||||
* Sets the value(s) for <b>quantity</b> (Optional amount (concentration))
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A code (or set of codes) that identify this substance
|
||||
* The amount of the ingredient in the substance - a concentration ratio
|
||||
* </p>
|
||||
*/
|
||||
public void setType(CodeableConceptDt theValue) {
|
||||
myType = theValue;
|
||||
public void setQuantity(RatioDt theValue) {
|
||||
myQuantity = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>description</b> (Textual description of the substance, comments).
|
||||
* Gets the value(s) for <b>substance</b> (A component of the substance).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A description of the substance - its appearance, handling requirements, and other usage notes
|
||||
* Another substance that is a component of this substance
|
||||
* </p>
|
||||
*/
|
||||
public StringDt getDescription() {
|
||||
if (myDescription == null) {
|
||||
myDescription = new StringDt();
|
||||
public ResourceReference getSubstance() {
|
||||
if (mySubstance == null) {
|
||||
mySubstance = new ResourceReference();
|
||||
}
|
||||
return myDescription;
|
||||
return mySubstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>description</b> (Textual description of the substance, comments)
|
||||
* Sets the value(s) for <b>substance</b> (A component of the substance)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A description of the substance - its appearance, handling requirements, and other usage notes
|
||||
* Another substance that is a component of this substance
|
||||
* </p>
|
||||
*/
|
||||
public void setDescription(StringDt theValue) {
|
||||
myDescription = theValue;
|
||||
public void setSubstance(ResourceReference theValue) {
|
||||
mySubstance = theValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>description</b> (Textual description of the substance, comments)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A description of the substance - its appearance, handling requirements, and other usage notes
|
||||
* </p>
|
||||
*/
|
||||
public void setDescription( String theString) {
|
||||
myDescription = new StringDt(theString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>instance</b> (If this describes a specific package/container of the substance).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance
|
||||
* </p>
|
||||
*/
|
||||
public Instance getInstance() {
|
||||
if (myInstance == null) {
|
||||
myInstance = new Instance();
|
||||
}
|
||||
return myInstance;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>instance</b> (If this describes a specific package/container of the substance)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance
|
||||
* </p>
|
||||
*/
|
||||
public void setInstance(Instance theValue) {
|
||||
myInstance = theValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>ingredient</b> (Composition information about the substance).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A substance can be composed of other substances
|
||||
* </p>
|
||||
*/
|
||||
public List<Ingredient> getIngredient() {
|
||||
if (myIngredient == null) {
|
||||
myIngredient = new ArrayList<Ingredient>();
|
||||
}
|
||||
return myIngredient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>ingredient</b> (Composition information about the substance)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A substance can be composed of other substances
|
||||
* </p>
|
||||
*/
|
||||
public void setIngredient(List<Ingredient> theValue) {
|
||||
myIngredient = theValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -601,7 +601,7 @@ public class ValueSet implements IResource {
|
|||
private BooleanDt myCaseSensitive;
|
||||
|
||||
@Child(name="concept", order=3, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<Concept> myConcept;
|
||||
private List<DefineConcept> myConcept;
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>system</b> (URI to identify the code system).
|
||||
|
@ -714,9 +714,9 @@ public class ValueSet implements IResource {
|
|||
*
|
||||
* </p>
|
||||
*/
|
||||
public List<Concept> getConcept() {
|
||||
public List<DefineConcept> getConcept() {
|
||||
if (myConcept == null) {
|
||||
myConcept = new ArrayList<Concept>();
|
||||
myConcept = new ArrayList<DefineConcept>();
|
||||
}
|
||||
return myConcept;
|
||||
}
|
||||
|
@ -729,11 +729,12 @@ public class ValueSet implements IResource {
|
|||
*
|
||||
* </p>
|
||||
*/
|
||||
public void setConcept(List<Concept> theValue) {
|
||||
public void setConcept(List<DefineConcept> theValue) {
|
||||
myConcept = theValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -745,7 +746,7 @@ public class ValueSet implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@Block(name="ValueSet.define.concept")
|
||||
public static class Concept implements IResourceBlock {
|
||||
public static class DefineConcept implements IResourceBlock {
|
||||
|
||||
@Child(name="code", type=CodeDt.class, order=0, min=1, max=1)
|
||||
private CodeDt myCode;
|
||||
|
@ -759,8 +760,8 @@ public class ValueSet implements IResource {
|
|||
@Child(name="definition", type=StringDt.class, order=3, min=0, max=1)
|
||||
private StringDt myDefinition;
|
||||
|
||||
@Child(name="concept", type=Concept.class, order=4, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<Concept> myConcept;
|
||||
@Child(name="concept", type=DefineConcept.class, order=4, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<DefineConcept> myConcept;
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>code</b> (Code that identifies concept).
|
||||
|
@ -914,9 +915,9 @@ public class ValueSet implements IResource {
|
|||
*
|
||||
* </p>
|
||||
*/
|
||||
public List<Concept> getConcept() {
|
||||
public List<DefineConcept> getConcept() {
|
||||
if (myConcept == null) {
|
||||
myConcept = new ArrayList<Concept>();
|
||||
myConcept = new ArrayList<DefineConcept>();
|
||||
}
|
||||
return myConcept;
|
||||
}
|
||||
|
@ -929,13 +930,16 @@ public class ValueSet implements IResource {
|
|||
*
|
||||
* </p>
|
||||
*/
|
||||
public void setConcept(List<Concept> theValue) {
|
||||
public void setConcept(List<DefineConcept> theValue) {
|
||||
myConcept = theValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Block class for child element: <b>ValueSet.compose</b> (When value set includes codes from elsewhere)
|
||||
*
|
||||
|
@ -951,10 +955,10 @@ public class ValueSet implements IResource {
|
|||
private List<UriDt> myImport;
|
||||
|
||||
@Child(name="include", order=1, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<Include> myInclude;
|
||||
private List<ComposeInclude> myInclude;
|
||||
|
||||
@Child(name="exclude", type=Include.class, order=2, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<Include> myExclude;
|
||||
@Child(name="exclude", type=ComposeInclude.class, order=2, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<ComposeInclude> myExclude;
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>import</b> (Import the contents of another value set).
|
||||
|
@ -996,9 +1000,9 @@ public class ValueSet implements IResource {
|
|||
* Include one or more codes from a code system
|
||||
* </p>
|
||||
*/
|
||||
public List<Include> getInclude() {
|
||||
public List<ComposeInclude> getInclude() {
|
||||
if (myInclude == null) {
|
||||
myInclude = new ArrayList<Include>();
|
||||
myInclude = new ArrayList<ComposeInclude>();
|
||||
}
|
||||
return myInclude;
|
||||
}
|
||||
|
@ -1011,7 +1015,7 @@ public class ValueSet implements IResource {
|
|||
* Include one or more codes from a code system
|
||||
* </p>
|
||||
*/
|
||||
public void setInclude(List<Include> theValue) {
|
||||
public void setInclude(List<ComposeInclude> theValue) {
|
||||
myInclude = theValue;
|
||||
}
|
||||
|
||||
|
@ -1026,9 +1030,9 @@ public class ValueSet implements IResource {
|
|||
* Exclude one or more codes from the value set
|
||||
* </p>
|
||||
*/
|
||||
public List<Include> getExclude() {
|
||||
public List<ComposeInclude> getExclude() {
|
||||
if (myExclude == null) {
|
||||
myExclude = new ArrayList<Include>();
|
||||
myExclude = new ArrayList<ComposeInclude>();
|
||||
}
|
||||
return myExclude;
|
||||
}
|
||||
|
@ -1041,11 +1045,12 @@ public class ValueSet implements IResource {
|
|||
* Exclude one or more codes from the value set
|
||||
* </p>
|
||||
*/
|
||||
public void setExclude(List<Include> theValue) {
|
||||
public void setExclude(List<ComposeInclude> theValue) {
|
||||
myExclude = theValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1057,7 +1062,7 @@ public class ValueSet implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@Block(name="ValueSet.compose.include")
|
||||
public static class Include implements IResourceBlock {
|
||||
public static class ComposeInclude implements IResourceBlock {
|
||||
|
||||
@Child(name="system", type=UriDt.class, order=0, min=1, max=1)
|
||||
private UriDt mySystem;
|
||||
|
@ -1069,7 +1074,7 @@ public class ValueSet implements IResource {
|
|||
private List<CodeDt> myCode;
|
||||
|
||||
@Child(name="filter", order=3, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<Filter> myFilter;
|
||||
private List<ComposeIncludeFilter> myFilter;
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>system</b> (The system the codes come from).
|
||||
|
@ -1182,9 +1187,9 @@ public class ValueSet implements IResource {
|
|||
* Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true.
|
||||
* </p>
|
||||
*/
|
||||
public List<Filter> getFilter() {
|
||||
public List<ComposeIncludeFilter> getFilter() {
|
||||
if (myFilter == null) {
|
||||
myFilter = new ArrayList<Filter>();
|
||||
myFilter = new ArrayList<ComposeIncludeFilter>();
|
||||
}
|
||||
return myFilter;
|
||||
}
|
||||
|
@ -1197,11 +1202,12 @@ public class ValueSet implements IResource {
|
|||
* Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true.
|
||||
* </p>
|
||||
*/
|
||||
public void setFilter(List<Filter> theValue) {
|
||||
public void setFilter(List<ComposeIncludeFilter> theValue) {
|
||||
myFilter = theValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1213,7 +1219,7 @@ public class ValueSet implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@Block(name="ValueSet.compose.include.filter")
|
||||
public static class Filter implements IResourceBlock {
|
||||
public static class ComposeIncludeFilter implements IResourceBlock {
|
||||
|
||||
@Child(name="property", type=CodeDt.class, order=0, min=1, max=1)
|
||||
private CodeDt myProperty;
|
||||
|
@ -1314,8 +1320,12 @@ public class ValueSet implements IResource {
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Block class for child element: <b>ValueSet.expansion</b> (When value set is an expansion)
|
||||
*
|
||||
|
@ -1334,7 +1344,7 @@ public class ValueSet implements IResource {
|
|||
private InstantDt myTimestamp;
|
||||
|
||||
@Child(name="contains", order=2, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<Contains> myContains;
|
||||
private List<ExpansionContains> myContains;
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>identifier</b> (Uniquely identifies this expansion).
|
||||
|
@ -1406,9 +1416,9 @@ public class ValueSet implements IResource {
|
|||
*
|
||||
* </p>
|
||||
*/
|
||||
public List<Contains> getContains() {
|
||||
public List<ExpansionContains> getContains() {
|
||||
if (myContains == null) {
|
||||
myContains = new ArrayList<Contains>();
|
||||
myContains = new ArrayList<ExpansionContains>();
|
||||
}
|
||||
return myContains;
|
||||
}
|
||||
|
@ -1421,11 +1431,12 @@ public class ValueSet implements IResource {
|
|||
*
|
||||
* </p>
|
||||
*/
|
||||
public void setContains(List<Contains> theValue) {
|
||||
public void setContains(List<ExpansionContains> theValue) {
|
||||
myContains = theValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1437,7 +1448,7 @@ public class ValueSet implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@Block(name="ValueSet.expansion.contains")
|
||||
public static class Contains implements IResourceBlock {
|
||||
public static class ExpansionContains implements IResourceBlock {
|
||||
|
||||
@Child(name="system", type=UriDt.class, order=0, min=0, max=1)
|
||||
private UriDt mySystem;
|
||||
|
@ -1448,8 +1459,8 @@ public class ValueSet implements IResource {
|
|||
@Child(name="display", type=StringDt.class, order=2, min=0, max=1)
|
||||
private StringDt myDisplay;
|
||||
|
||||
@Child(name="contains", type=Contains.class, order=3, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<Contains> myContains;
|
||||
@Child(name="contains", type=ExpansionContains.class, order=3, min=0, max=Child.MAX_UNLIMITED)
|
||||
private List<ExpansionContains> myContains;
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>system</b> (System value for the code).
|
||||
|
@ -1562,9 +1573,9 @@ public class ValueSet implements IResource {
|
|||
*
|
||||
* </p>
|
||||
*/
|
||||
public List<Contains> getContains() {
|
||||
public List<ExpansionContains> getContains() {
|
||||
if (myContains == null) {
|
||||
myContains = new ArrayList<Contains>();
|
||||
myContains = new ArrayList<ExpansionContains>();
|
||||
}
|
||||
return myContains;
|
||||
}
|
||||
|
@ -1577,13 +1588,16 @@ public class ValueSet implements IResource {
|
|||
*
|
||||
* </p>
|
||||
*/
|
||||
public void setContains(List<Contains> theValue) {
|
||||
public void setContains(List<ExpansionContains> theValue) {
|
||||
myContains = theValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -18,117 +18,29 @@ import ca.uhn.fhir.context.RuntimePrimitiveDatatypeNarrativeDefinition;
|
|||
import ca.uhn.fhir.context.RuntimeResourceBlockDefinition;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.context.RuntimeResourceReferenceDefinition;
|
||||
import ca.uhn.fhir.model.api.ISupportsUndeclaredExtensions;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
||||
import ca.uhn.fhir.model.api.ICompositeElement;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.ISupportsUndeclaredExtensions;
|
||||
import ca.uhn.fhir.model.api.ResourceReference;
|
||||
import ca.uhn.fhir.model.api.UndeclaredExtension;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.XhtmlDt;
|
||||
|
||||
class ParserState {
|
||||
|
||||
public class DeclaredExtensionState extends BaseState {
|
||||
|
||||
private RuntimeChildDeclaredExtensionDefinition myDefinition;
|
||||
private IElement myParentInstance;
|
||||
private IElement myChildInstance;
|
||||
|
||||
public DeclaredExtensionState(RuntimeChildDeclaredExtensionDefinition theDefinition, IElement theParentInstance) {
|
||||
myDefinition = theDefinition;
|
||||
myParentInstance = theParentInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attributeValue(Attribute theAttribute, String theValue) throws DataFormatException {
|
||||
throw new DataFormatException("'value' attribute is invalid in 'extension' element");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endingElement(EndElement theElem) throws DataFormatException {
|
||||
pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElementExtension(StartElement theElement, String theUrlAttr) {
|
||||
RuntimeChildDeclaredExtensionDefinition declaredExtension = myDefinition.getChildExtensionForUrl(theUrlAttr);
|
||||
if (declaredExtension != null) {
|
||||
if (myChildInstance == null) {
|
||||
myChildInstance = myDefinition.newInstance();
|
||||
myDefinition.getMutator().addValue(myParentInstance, myChildInstance);
|
||||
}
|
||||
BaseState newState = new DeclaredExtensionState(declaredExtension, myChildInstance);
|
||||
push(newState);
|
||||
}else {
|
||||
super.enteringNewElementExtension(theElement, theUrlAttr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElement(StartElement theElement, String theLocalPart) throws DataFormatException {
|
||||
BaseRuntimeElementDefinition<?> target = myDefinition.getChildByName(theLocalPart);
|
||||
if (target == null) {
|
||||
throw new DataFormatException("Unknown extension element name: " + theLocalPart);
|
||||
}
|
||||
|
||||
switch (target.getChildType()) {
|
||||
case COMPOSITE_DATATYPE: {
|
||||
BaseRuntimeElementCompositeDefinition<?> compositeTarget = (BaseRuntimeElementCompositeDefinition<?>) target;
|
||||
ICompositeDatatype newChildInstance = (ICompositeDatatype) compositeTarget.newInstance();
|
||||
myDefinition.getMutator().addValue(myParentInstance, newChildInstance);
|
||||
ContainerState newState = new ContainerState(compositeTarget, newChildInstance);
|
||||
push(newState);
|
||||
return;
|
||||
}
|
||||
case PRIMITIVE_DATATYPE: {
|
||||
RuntimePrimitiveDatatypeDefinition primitiveTarget = (RuntimePrimitiveDatatypeDefinition) target;
|
||||
IPrimitiveDatatype<?> newChildInstance = primitiveTarget.newInstance();
|
||||
myDefinition.getMutator().addValue(myParentInstance, newChildInstance);
|
||||
PrimitiveState newState = new PrimitiveState(newChildInstance);
|
||||
push(newState);
|
||||
return;
|
||||
}
|
||||
case RESOURCE_REF: {
|
||||
RuntimeResourceReferenceDefinition resourceRefTarget = (RuntimeResourceReferenceDefinition) target;
|
||||
ResourceReference newChildInstance = new ResourceReference();
|
||||
myDefinition.getMutator().addValue(myParentInstance, newChildInstance);
|
||||
ResourceReferenceState newState = new ResourceReferenceState(resourceRefTarget, newChildInstance);
|
||||
push(newState);
|
||||
return;
|
||||
}
|
||||
case PRIMITIVE_XHTML:
|
||||
case RESOURCE:
|
||||
case RESOURCE_BLOCK:
|
||||
case UNDECL_EXT:
|
||||
case EXTENSION_DECLARED:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void otherEvent(XMLEvent theEvent) throws DataFormatException {
|
||||
// ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return myParentInstance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ParserState.class);
|
||||
|
||||
private FhirContext myContext;
|
||||
|
||||
private Object myObject;
|
||||
|
||||
private BaseState myState;
|
||||
|
||||
public ParserState(FhirContext theContext) {
|
||||
private ParserState(FhirContext theContext) {
|
||||
myContext = theContext;
|
||||
}
|
||||
|
||||
|
@ -162,6 +74,7 @@ class ParserState {
|
|||
|
||||
private void pop() {
|
||||
myState = myState.myStack;
|
||||
myState.wereBack();
|
||||
}
|
||||
|
||||
private void push(BaseState theState) {
|
||||
|
@ -169,26 +82,142 @@ class ParserState {
|
|||
myState = theState;
|
||||
}
|
||||
|
||||
private void setState(BaseState theState) {
|
||||
myState = theState;
|
||||
}
|
||||
|
||||
public static ParserState getResourceInstance(FhirContext theContext, String theLocalPart) throws DataFormatException {
|
||||
BaseRuntimeElementDefinition<?> definition = theContext.getNameToResourceDefinition().get(theLocalPart);
|
||||
if (!(definition instanceof RuntimeResourceDefinition)) {
|
||||
throw new DataFormatException("Element '" + theLocalPart + "' is not a resource, expected a resource at this position");
|
||||
}
|
||||
|
||||
RuntimeResourceDefinition def = (RuntimeResourceDefinition) definition;
|
||||
IResource instance = def.newInstance();
|
||||
|
||||
public static ParserState getPreResourceInstance(FhirContext theContext) throws DataFormatException {
|
||||
ParserState retVal = new ParserState(theContext);
|
||||
retVal.setState(retVal.new ContainerState(def, instance));
|
||||
|
||||
retVal.push(retVal.new PreResourceState());
|
||||
return retVal;
|
||||
}
|
||||
|
||||
private class AtomPrimitiveState extends BaseState{
|
||||
|
||||
private IPrimitiveDatatype<?> myPrimitive;
|
||||
private String myData;
|
||||
|
||||
public AtomPrimitiveState(IPrimitiveDatatype<?> thePrimitive) {
|
||||
myPrimitive = thePrimitive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attributeValue(Attribute theAttribute, String theValue) throws DataFormatException {
|
||||
// ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endingElement(EndElement theElem) throws DataFormatException {
|
||||
myPrimitive.setValueAsString(myData);
|
||||
pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElement(StartElement theElement, String theLocalPart) throws DataFormatException {
|
||||
throw new DataFormatException("Unexpected nested element in atom tag ");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void otherEvent(XMLEvent theEvent) throws DataFormatException {
|
||||
if (theEvent.isCharacters()) {
|
||||
String data = theEvent.asCharacters().getData();
|
||||
if (myData == null) {
|
||||
myData = data;
|
||||
}else {
|
||||
// this shouldn't generally happen so it's ok that it's inefficient
|
||||
myData = myData + data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class AtomState extends BaseState {
|
||||
|
||||
private Bundle myInstance;
|
||||
|
||||
public AtomState(Bundle theInstance) {
|
||||
myInstance = theInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attributeValue(Attribute theAttribute, String theValue) throws DataFormatException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endingElement(EndElement theElem) throws DataFormatException {
|
||||
pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElement(StartElement theElement, String theLocalPart) throws DataFormatException {
|
||||
if (theLocalPart.equals("title")) {
|
||||
push(new AtomPrimitiveState(myInstance.getTitle()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void otherEvent(XMLEvent theEvent) throws DataFormatException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class PreAtomState extends BaseState {
|
||||
|
||||
private Bundle myInstance;
|
||||
|
||||
@Override
|
||||
public void attributeValue(Attribute theAttribute, String theValue) throws DataFormatException {
|
||||
// ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endingElement(EndElement theElem) throws DataFormatException {
|
||||
// ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElement(StartElement theElement, String theLocalPart) throws DataFormatException {
|
||||
if (!"feed".equals(theLocalPart)) {
|
||||
throw new DataFormatException("Expecting outer element called 'feed', found: "+theLocalPart);
|
||||
}
|
||||
|
||||
myInstance = new Bundle();
|
||||
push(new AtomState(myInstance));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wereBack() {
|
||||
myObject = myInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void otherEvent(XMLEvent theEvent) throws DataFormatException {
|
||||
// ignore
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private abstract class BaseState {
|
||||
|
||||
private BaseState myStack;
|
||||
|
||||
public abstract void attributeValue(Attribute theAttribute, String theValue) throws DataFormatException;
|
||||
|
@ -211,22 +240,116 @@ class ParserState {
|
|||
}
|
||||
}
|
||||
|
||||
protected abstract IElement getCurrentElement();
|
||||
|
||||
public abstract void otherEvent(XMLEvent theEvent) throws DataFormatException;
|
||||
|
||||
public void setStack(BaseState theState) {
|
||||
myStack = theState;
|
||||
}
|
||||
|
||||
protected abstract IElement getCurrentElement();
|
||||
public void wereBack() {
|
||||
// allow an implementor to override
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class ContainerState extends BaseState {
|
||||
private class DeclaredExtensionState extends BaseState {
|
||||
|
||||
private IElement myChildInstance;
|
||||
private RuntimeChildDeclaredExtensionDefinition myDefinition;
|
||||
private IElement myParentInstance;
|
||||
|
||||
public DeclaredExtensionState(RuntimeChildDeclaredExtensionDefinition theDefinition, IElement theParentInstance) {
|
||||
myDefinition = theDefinition;
|
||||
myParentInstance = theParentInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attributeValue(Attribute theAttribute, String theValue) throws DataFormatException {
|
||||
throw new DataFormatException("'value' attribute is invalid in 'extension' element");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endingElement(EndElement theElem) throws DataFormatException {
|
||||
pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElement(StartElement theElement, String theLocalPart) throws DataFormatException {
|
||||
BaseRuntimeElementDefinition<?> target = myDefinition.getChildByName(theLocalPart);
|
||||
if (target == null) {
|
||||
throw new DataFormatException("Unknown extension element name: " + theLocalPart);
|
||||
}
|
||||
|
||||
switch (target.getChildType()) {
|
||||
case COMPOSITE_DATATYPE: {
|
||||
BaseRuntimeElementCompositeDefinition<?> compositeTarget = (BaseRuntimeElementCompositeDefinition<?>) target;
|
||||
ICompositeDatatype newChildInstance = (ICompositeDatatype) compositeTarget.newInstance();
|
||||
myDefinition.getMutator().addValue(myParentInstance, newChildInstance);
|
||||
ElementCompositeState newState = new ElementCompositeState(compositeTarget, newChildInstance);
|
||||
push(newState);
|
||||
return;
|
||||
}
|
||||
case PRIMITIVE_DATATYPE: {
|
||||
RuntimePrimitiveDatatypeDefinition primitiveTarget = (RuntimePrimitiveDatatypeDefinition) target;
|
||||
IPrimitiveDatatype<?> newChildInstance = primitiveTarget.newInstance();
|
||||
myDefinition.getMutator().addValue(myParentInstance, newChildInstance);
|
||||
PrimitiveState newState = new PrimitiveState(newChildInstance);
|
||||
push(newState);
|
||||
return;
|
||||
}
|
||||
case RESOURCE_REF: {
|
||||
RuntimeResourceReferenceDefinition resourceRefTarget = (RuntimeResourceReferenceDefinition) target;
|
||||
ResourceReference newChildInstance = new ResourceReference();
|
||||
myDefinition.getMutator().addValue(myParentInstance, newChildInstance);
|
||||
ResourceReferenceState newState = new ResourceReferenceState(resourceRefTarget, newChildInstance);
|
||||
push(newState);
|
||||
return;
|
||||
}
|
||||
case PRIMITIVE_XHTML:
|
||||
case RESOURCE:
|
||||
case RESOURCE_BLOCK:
|
||||
case UNDECL_EXT:
|
||||
case EXTENSION_DECLARED:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElementExtension(StartElement theElement, String theUrlAttr) {
|
||||
RuntimeChildDeclaredExtensionDefinition declaredExtension = myDefinition.getChildExtensionForUrl(theUrlAttr);
|
||||
if (declaredExtension != null) {
|
||||
if (myChildInstance == null) {
|
||||
myChildInstance = myDefinition.newInstance();
|
||||
myDefinition.getMutator().addValue(myParentInstance, myChildInstance);
|
||||
}
|
||||
BaseState newState = new DeclaredExtensionState(declaredExtension, myChildInstance);
|
||||
push(newState);
|
||||
} else {
|
||||
super.enteringNewElementExtension(theElement, theUrlAttr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return myParentInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void otherEvent(XMLEvent theEvent) throws DataFormatException {
|
||||
// ignore
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class ElementCompositeState extends BaseState {
|
||||
|
||||
private BaseRuntimeElementCompositeDefinition<?> myDefinition;
|
||||
private ICompositeElement myInstance;
|
||||
|
||||
public ContainerState(BaseRuntimeElementCompositeDefinition<?> theDef, ICompositeElement theInstance) {
|
||||
public ElementCompositeState(BaseRuntimeElementCompositeDefinition<?> theDef, ICompositeElement theInstance) {
|
||||
myDefinition = theDef;
|
||||
myInstance = theInstance;
|
||||
}
|
||||
|
@ -244,17 +367,6 @@ class ParserState {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElementExtension(StartElement theElement, String theUrlAttr) {
|
||||
RuntimeChildDeclaredExtensionDefinition declaredExtension = myDefinition.getDeclaredExtension(theUrlAttr);
|
||||
if (declaredExtension != null) {
|
||||
BaseState newState = new DeclaredExtensionState(declaredExtension, myInstance);
|
||||
push(newState);
|
||||
}else {
|
||||
super.enteringNewElementExtension(theElement, theUrlAttr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElement(StartElement theElement, String theChildName) throws DataFormatException {
|
||||
BaseRuntimeChildDefinition child = myDefinition.getChildByNameOrThrowDataFormatException(theChildName);
|
||||
|
@ -262,13 +374,13 @@ class ParserState {
|
|||
if (target == null) {
|
||||
throw new DataFormatException("Found unexpected element '" + theChildName + "' in parent element '" + myDefinition.getName() + "'. Valid names are: " + child.getValidChildNames());
|
||||
}
|
||||
|
||||
|
||||
switch (target.getChildType()) {
|
||||
case COMPOSITE_DATATYPE: {
|
||||
BaseRuntimeElementCompositeDefinition<?> compositeTarget = (BaseRuntimeElementCompositeDefinition<?>) target;
|
||||
ICompositeDatatype newChildInstance = (ICompositeDatatype) compositeTarget.newInstance();
|
||||
child.getMutator().addValue(myInstance, newChildInstance);
|
||||
ContainerState newState = new ContainerState(compositeTarget, newChildInstance);
|
||||
ElementCompositeState newState = new ElementCompositeState(compositeTarget, newChildInstance);
|
||||
push(newState);
|
||||
return;
|
||||
}
|
||||
|
@ -292,7 +404,7 @@ class ParserState {
|
|||
RuntimeResourceBlockDefinition blockTarget = (RuntimeResourceBlockDefinition) target;
|
||||
IResourceBlock newBlockInstance = blockTarget.newInstance();
|
||||
child.getMutator().addValue(myInstance, newBlockInstance);
|
||||
ContainerState newState = new ContainerState(blockTarget, newBlockInstance);
|
||||
ElementCompositeState newState = new ElementCompositeState(blockTarget, newBlockInstance);
|
||||
push(newState);
|
||||
return;
|
||||
}
|
||||
|
@ -315,8 +427,14 @@ class ParserState {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void otherEvent(XMLEvent theEvent) {
|
||||
// ignore
|
||||
public void enteringNewElementExtension(StartElement theElement, String theUrlAttr) {
|
||||
RuntimeChildDeclaredExtensionDefinition declaredExtension = myDefinition.getDeclaredExtension(theUrlAttr);
|
||||
if (declaredExtension != null) {
|
||||
BaseState newState = new DeclaredExtensionState(declaredExtension, myInstance);
|
||||
push(newState);
|
||||
} else {
|
||||
super.enteringNewElementExtension(theElement, theUrlAttr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -324,6 +442,11 @@ class ParserState {
|
|||
return myInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void otherEvent(XMLEvent theEvent) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class ExtensionState extends BaseState {
|
||||
|
@ -359,7 +482,7 @@ class ParserState {
|
|||
BaseRuntimeElementCompositeDefinition<?> compositeTarget = (BaseRuntimeElementCompositeDefinition<?>) target;
|
||||
ICompositeDatatype newChildInstance = (ICompositeDatatype) compositeTarget.newInstance();
|
||||
myExtension.setValue(newChildInstance);
|
||||
ContainerState newState = new ContainerState(compositeTarget, newChildInstance);
|
||||
ElementCompositeState newState = new ElementCompositeState(compositeTarget, newChildInstance);
|
||||
push(newState);
|
||||
return;
|
||||
}
|
||||
|
@ -387,14 +510,58 @@ class ParserState {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return myExtension;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void otherEvent(XMLEvent theEvent) throws DataFormatException {
|
||||
// ignore
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class PreResourceState extends BaseState {
|
||||
|
||||
private ICompositeElement myInstance;
|
||||
|
||||
@Override
|
||||
public void attributeValue(Attribute theAttribute, String theValue) throws DataFormatException {
|
||||
// ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endingElement(EndElement theElem) throws DataFormatException {
|
||||
// ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElement(StartElement theElement, String theLocalPart) throws DataFormatException {
|
||||
BaseRuntimeElementDefinition<?> definition = myContext.getNameToResourceDefinition().get(theLocalPart);
|
||||
if (!(definition instanceof RuntimeResourceDefinition)) {
|
||||
throw new DataFormatException("Element '" + theLocalPart + "' is not a resource, expected a resource at this position");
|
||||
}
|
||||
|
||||
RuntimeResourceDefinition def = (RuntimeResourceDefinition) definition;
|
||||
myInstance = def.newInstance();
|
||||
|
||||
push(new ElementCompositeState(def, myInstance));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return myInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void otherEvent(XMLEvent theEvent) throws DataFormatException {
|
||||
// ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return myExtension;
|
||||
public void wereBack() {
|
||||
myObject = myInstance;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -423,13 +590,13 @@ class ParserState {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void otherEvent(XMLEvent theEvent) {
|
||||
// ignore
|
||||
protected IElement getCurrentElement() {
|
||||
return myInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return myInstance;
|
||||
public void otherEvent(XMLEvent theEvent) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -491,13 +658,13 @@ class ParserState {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void otherEvent(XMLEvent theEvent) {
|
||||
// ignore
|
||||
protected IElement getCurrentElement() {
|
||||
return myInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return myInstance;
|
||||
public void otherEvent(XMLEvent theEvent) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -540,13 +707,13 @@ class ParserState {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void otherEvent(XMLEvent theEvent) throws DataFormatException {
|
||||
myEvents.add(theEvent);
|
||||
protected IElement getCurrentElement() {
|
||||
return myDt;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return myDt;
|
||||
public void otherEvent(XMLEvent theEvent) throws DataFormatException {
|
||||
myEvents.add(theEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,11 +5,9 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
|||
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.stream.FactoryConfigurationError;
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
|
@ -28,7 +26,6 @@ import javax.xml.stream.events.StartElement;
|
|||
import javax.xml.stream.events.XMLEvent;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
|
||||
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
||||
import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition;
|
||||
|
@ -45,16 +42,18 @@ import ca.uhn.fhir.model.api.IResource;
|
|||
import ca.uhn.fhir.model.api.ISupportsUndeclaredExtensions;
|
||||
import ca.uhn.fhir.model.api.ResourceReference;
|
||||
import ca.uhn.fhir.model.api.UndeclaredExtension;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.XhtmlDt;
|
||||
import ca.uhn.fhir.util.PrettyPrintWriterWrapper;
|
||||
|
||||
public class XmlParser {
|
||||
private static final String XHTML_NS = "http://www.w3.org/1999/xhtml";
|
||||
private static final String ATOM_NS = "http://www.w3.org/2005/Atom";
|
||||
private static final String FHIR_NS = "http://hl7.org/fhir";
|
||||
private static final String OPENSEARCH_NS = "http://a9.com/-/spec/opensearch/1.1/";
|
||||
@SuppressWarnings("unused")
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(XmlParser.class);
|
||||
private static final String ATOM_NS = "http://www.w3.org/2005/Atom";
|
||||
private static final String OPENSEARCH_NS = "http://a9.com/-/spec/opensearch/1.1/";
|
||||
private static final String XHTML_NS = "http://www.w3.org/1999/xhtml";
|
||||
|
||||
private FhirContext myContext;
|
||||
private XMLInputFactory myXmlInputFactory;
|
||||
|
@ -66,14 +65,62 @@ public class XmlParser {
|
|||
myXmlOutputFactory = XMLOutputFactory.newInstance();
|
||||
}
|
||||
|
||||
public String encodeResourceToString(IResource theResource) throws DataFormatException {
|
||||
private XMLStreamWriter decorateStreamWriter(XMLStreamWriter eventWriter) {
|
||||
PrettyPrintWriterWrapper retVal = new PrettyPrintWriterWrapper(eventWriter);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public String encodeBundleToString(Bundle theBundle) throws DataFormatException {
|
||||
XMLStreamWriter eventWriter;
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
try {
|
||||
eventWriter = myXmlOutputFactory.createXMLStreamWriter(stringWriter);
|
||||
eventWriter = decorateStreamWriter(eventWriter);
|
||||
|
||||
encodeResourceToStreamWriter(theResource, eventWriter);
|
||||
eventWriter.writeStartElement("feed");
|
||||
eventWriter.writeDefaultNamespace(ATOM_NS);
|
||||
|
||||
writeTagWithTextNode(eventWriter, "title", theBundle.getTitle());
|
||||
writeTagWithTextNode(eventWriter, "id", theBundle.getId());
|
||||
|
||||
writeAtomLink(eventWriter, "self", theBundle.getLinkSelf());
|
||||
writeAtomLink(eventWriter, "first", theBundle.getLinkFirst());
|
||||
writeAtomLink(eventWriter, "previous", theBundle.getLinkPrevious());
|
||||
writeAtomLink(eventWriter, "next", theBundle.getLinkNext());
|
||||
writeAtomLink(eventWriter, "last", theBundle.getLinkLast());
|
||||
writeAtomLink(eventWriter, "fhir-base", theBundle.getLinkBase());
|
||||
|
||||
if (theBundle.getTotalResults() != null) {
|
||||
eventWriter.writeNamespace("os", OPENSEARCH_NS);
|
||||
eventWriter.writeStartElement(OPENSEARCH_NS, "totalResults");
|
||||
eventWriter.writeCharacters(theBundle.getTotalResults().toString());
|
||||
eventWriter.writeEndElement();
|
||||
}
|
||||
|
||||
writeOptionalTagWithTextNode(eventWriter, "updated", theBundle.getUpdated());
|
||||
writeOptionalTagWithTextNode(eventWriter, "published", theBundle.getPublished());
|
||||
|
||||
if (StringUtils.isNotBlank(theBundle.getAuthorName().getValue())) {
|
||||
eventWriter.writeStartElement("author");
|
||||
writeTagWithTextNode(eventWriter, "name", theBundle.getAuthorName());
|
||||
writeOptionalTagWithTextNode(eventWriter, "device", theBundle.getAuthorDevice());
|
||||
}
|
||||
|
||||
for (BundleEntry nextEntry : theBundle.getEntries()) {
|
||||
eventWriter.writeStartElement("entry");
|
||||
|
||||
eventWriter.writeStartElement("content");
|
||||
eventWriter.writeAttribute("type", "text/xml");
|
||||
|
||||
IResource resource = nextEntry.getResource();
|
||||
encodeResourceToStreamWriter(resource, eventWriter);
|
||||
|
||||
eventWriter.writeEndElement(); // content
|
||||
eventWriter.writeEndElement(); // entry
|
||||
}
|
||||
|
||||
eventWriter.writeEndElement();
|
||||
eventWriter.close();
|
||||
} catch (XMLStreamException e) {
|
||||
throw new ConfigurationException("Failed to initialize STaX event factory", e);
|
||||
}
|
||||
|
@ -81,61 +128,6 @@ public class XmlParser {
|
|||
return stringWriter.toString();
|
||||
}
|
||||
|
||||
public void encodeResourceToStreamWriter(IResource theResource, XMLStreamWriter eventWriter) throws XMLStreamException, DataFormatException {
|
||||
RuntimeResourceDefinition resDef = myContext.getResourceDefinition(theResource);
|
||||
eventWriter.writeStartElement(resDef.getName());
|
||||
eventWriter.writeDefaultNamespace(FHIR_NS);
|
||||
|
||||
encodeCompositeElementToStreamWriter(theResource, eventWriter, resDef);
|
||||
|
||||
eventWriter.writeEndElement();
|
||||
eventWriter.close();
|
||||
}
|
||||
|
||||
private XMLStreamWriter decorateStreamWriter(XMLStreamWriter eventWriter) {
|
||||
PrettyPrintWriterWrapper retVal = new PrettyPrintWriterWrapper(eventWriter);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
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()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (IElement nextValue : values) {
|
||||
if (nextValue == null) {
|
||||
continue;
|
||||
}
|
||||
Class<? extends IElement> type = nextValue.getClass();
|
||||
String childName = nextChild.getChildNameByDatatype(type);
|
||||
String extensionUrl = nextChild.getExtensionUrl();
|
||||
BaseRuntimeElementDefinition<?> childDef = nextChild.getChildElementDefinitionByDatatype(type);
|
||||
if (childDef == null) {
|
||||
throw new IllegalStateException(nextChild + " has no child of type " + type);
|
||||
}
|
||||
|
||||
if (extensionUrl != null && childName.equals("extension") == false) {
|
||||
theEventWriter.writeStartElement("extension");
|
||||
theEventWriter.writeAttribute("url", extensionUrl);
|
||||
encodeChildElementToStreamWriter(theEventWriter, nextValue, childName, childDef, null);
|
||||
theEventWriter.writeEndElement();
|
||||
} else {
|
||||
encodeChildElementToStreamWriter(theEventWriter, nextValue, childName, childDef, extensionUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void encodeChildElementToStreamWriter(XMLStreamWriter theEventWriter, IElement nextValue, String childName, BaseRuntimeElementDefinition<?> childDef, String theExtensionUrl)
|
||||
throws XMLStreamException, DataFormatException {
|
||||
switch (childDef.getChildType()) {
|
||||
|
@ -180,6 +172,45 @@ public class XmlParser {
|
|||
}
|
||||
}
|
||||
|
||||
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()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (IElement nextValue : values) {
|
||||
if (nextValue == null) {
|
||||
continue;
|
||||
}
|
||||
Class<? extends IElement> type = nextValue.getClass();
|
||||
String childName = nextChild.getChildNameByDatatype(type);
|
||||
String extensionUrl = nextChild.getExtensionUrl();
|
||||
BaseRuntimeElementDefinition<?> childDef = nextChild.getChildElementDefinitionByDatatype(type);
|
||||
if (childDef == null) {
|
||||
throw new IllegalStateException(nextChild + " has no child of type " + type);
|
||||
}
|
||||
|
||||
if (extensionUrl != null && childName.equals("extension") == false) {
|
||||
theEventWriter.writeStartElement("extension");
|
||||
theEventWriter.writeAttribute("url", extensionUrl);
|
||||
encodeChildElementToStreamWriter(theEventWriter, nextValue, childName, childDef, null);
|
||||
theEventWriter.writeEndElement();
|
||||
} else {
|
||||
encodeChildElementToStreamWriter(theEventWriter, nextValue, childName, childDef, extensionUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
private void encodeExtensionsIfPresent(XMLStreamWriter theWriter, IElement theResource) throws XMLStreamException, DataFormatException {
|
||||
if (theResource instanceof ISupportsUndeclaredExtensions) {
|
||||
for (UndeclaredExtension next : ((ISupportsUndeclaredExtensions) theResource).getUndeclaredExtensions()) {
|
||||
|
@ -202,58 +233,38 @@ public class XmlParser {
|
|||
}
|
||||
}
|
||||
|
||||
public String encodeBundleToString(Bundle theBundle) throws DataFormatException {
|
||||
private void encodeResourceReferenceToStreamWriter(XMLStreamWriter theEventWriter, ResourceReference theRef) throws XMLStreamException {
|
||||
if (StringUtils.isNotBlank(theRef.getDisplay())) {
|
||||
theEventWriter.writeStartElement("display");
|
||||
theEventWriter.writeAttribute("value", theRef.getDisplay());
|
||||
theEventWriter.writeEndElement();
|
||||
}
|
||||
if (StringUtils.isNotBlank(theRef.getReference())) {
|
||||
theEventWriter.writeStartElement("reference");
|
||||
theEventWriter.writeAttribute("value", theRef.getReference());
|
||||
theEventWriter.writeEndElement();
|
||||
}
|
||||
}
|
||||
|
||||
public void encodeResourceToStreamWriter(IResource theResource, XMLStreamWriter eventWriter) throws XMLStreamException, DataFormatException {
|
||||
RuntimeResourceDefinition resDef = myContext.getResourceDefinition(theResource);
|
||||
eventWriter.writeStartElement(resDef.getName());
|
||||
eventWriter.writeDefaultNamespace(FHIR_NS);
|
||||
|
||||
encodeCompositeElementToStreamWriter(theResource, eventWriter, resDef);
|
||||
|
||||
eventWriter.writeEndElement();
|
||||
eventWriter.close();
|
||||
}
|
||||
|
||||
public String encodeResourceToString(IResource theResource) throws DataFormatException {
|
||||
XMLStreamWriter eventWriter;
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
try {
|
||||
eventWriter = myXmlOutputFactory.createXMLStreamWriter(stringWriter);
|
||||
eventWriter = decorateStreamWriter(eventWriter);
|
||||
|
||||
eventWriter.writeStartElement("feed");
|
||||
eventWriter.writeDefaultNamespace(ATOM_NS);
|
||||
|
||||
writeTagWithTextNode(eventWriter, "title", theBundle.getTitle());
|
||||
writeTagWithTextNode(eventWriter, "id", theBundle.getId());
|
||||
|
||||
writeAtomLink(eventWriter, "self", theBundle.getLinkSelf());
|
||||
writeAtomLink(eventWriter, "first", theBundle.getLinkFirst());
|
||||
writeAtomLink(eventWriter, "previous", theBundle.getLinkPrevious());
|
||||
writeAtomLink(eventWriter, "next", theBundle.getLinkNext());
|
||||
writeAtomLink(eventWriter, "last", theBundle.getLinkLast());
|
||||
writeAtomLink(eventWriter, "fhir-base", theBundle.getLinkBase());
|
||||
|
||||
if (theBundle.getTotalResults() != null) {
|
||||
eventWriter.writeNamespace("os", OPENSEARCH_NS);
|
||||
eventWriter.writeStartElement(OPENSEARCH_NS, "totalResults");
|
||||
eventWriter.writeCharacters(theBundle.getTotalResults().toString());
|
||||
eventWriter.writeEndElement();
|
||||
}
|
||||
|
||||
writeOptionalTagWithTextNode(eventWriter, "updated", theBundle.getUpdated());
|
||||
writeOptionalTagWithTextNode(eventWriter, "published", theBundle.getPublished());
|
||||
|
||||
if (StringUtils.isNotBlank(theBundle.getAuthorName())) {
|
||||
eventWriter.writeStartElement("author");
|
||||
writeTagWithTextNode(eventWriter, "name", theBundle.getAuthorName());
|
||||
writeOptionalTagWithTextNode(eventWriter, "device", theBundle.getAuthorDevice());
|
||||
}
|
||||
|
||||
for (BundleEntry nextEntry : theBundle.getEntries()) {
|
||||
eventWriter.writeStartElement("entry");
|
||||
|
||||
eventWriter.writeStartElement("content");
|
||||
eventWriter.writeAttribute("type", "text/xml");
|
||||
|
||||
IResource resource = nextEntry.getResource();
|
||||
encodeResourceToStreamWriter(resource, eventWriter);
|
||||
|
||||
eventWriter.writeEndElement(); // content
|
||||
|
||||
eventWriter.writeEndElement(); // entry
|
||||
}
|
||||
|
||||
eventWriter.writeEndElement();
|
||||
eventWriter.close();
|
||||
encodeResourceToStreamWriter(theResource, eventWriter);
|
||||
} catch (XMLStreamException e) {
|
||||
throw new ConfigurationException("Failed to initialize STaX event factory", e);
|
||||
}
|
||||
|
@ -261,38 +272,6 @@ public class XmlParser {
|
|||
return stringWriter.toString();
|
||||
}
|
||||
|
||||
private void writeOptionalTagWithTextNode(XMLStreamWriter theEventWriter, String theTagName, Date theNodeValue) throws XMLStreamException {
|
||||
if (theNodeValue != null) {
|
||||
theEventWriter.writeStartElement(theTagName);
|
||||
theEventWriter.writeCharacters(DatatypeConverter.printDateTime(DateUtils.toCalendar(theNodeValue)));
|
||||
theEventWriter.writeEndElement();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeAtomLink(XMLStreamWriter theEventWriter, String theRel, String theLink) throws XMLStreamException {
|
||||
if (StringUtils.isNotBlank(theLink)) {
|
||||
theEventWriter.writeStartElement("link");
|
||||
theEventWriter.writeAttribute("rel", theRel);
|
||||
theEventWriter.writeAttribute("href", theLink);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeTagWithTextNode(XMLStreamWriter theEventWriter, String theElementName, String theTextValue) throws XMLStreamException {
|
||||
theEventWriter.writeStartElement(theElementName);
|
||||
if (StringUtils.isNotBlank(theTextValue)) {
|
||||
theEventWriter.writeCharacters(theTextValue);
|
||||
}
|
||||
theEventWriter.writeEndElement();
|
||||
}
|
||||
|
||||
private void writeOptionalTagWithTextNode(XMLStreamWriter theEventWriter, String theElementName, String theTextValue) throws XMLStreamException {
|
||||
if (StringUtils.isNotBlank(theTextValue)) {
|
||||
theEventWriter.writeStartElement(theElementName);
|
||||
theEventWriter.writeCharacters(theTextValue);
|
||||
theEventWriter.writeEndElement();
|
||||
}
|
||||
}
|
||||
|
||||
private void encodeXhtml(XhtmlDt theDt, XMLStreamWriter theEventWriter) throws XMLStreamException {
|
||||
if (theDt == null || theDt.getValue() == null) {
|
||||
return;
|
||||
|
@ -365,19 +344,6 @@ public class XmlParser {
|
|||
}
|
||||
}
|
||||
|
||||
private void encodeResourceReferenceToStreamWriter(XMLStreamWriter theEventWriter, ResourceReference theRef) throws XMLStreamException {
|
||||
if (StringUtils.isNotBlank(theRef.getDisplay())) {
|
||||
theEventWriter.writeStartElement("display");
|
||||
theEventWriter.writeAttribute("value", theRef.getDisplay());
|
||||
theEventWriter.writeEndElement();
|
||||
}
|
||||
if (StringUtils.isNotBlank(theRef.getReference())) {
|
||||
theEventWriter.writeStartElement("reference");
|
||||
theEventWriter.writeAttribute("value", theRef.getReference());
|
||||
theEventWriter.writeEndElement();
|
||||
}
|
||||
}
|
||||
|
||||
public IResource parseResource(String theXml) throws ConfigurationException, DataFormatException {
|
||||
XMLEventReader streamReader;
|
||||
try {
|
||||
|
@ -388,8 +354,32 @@ public class XmlParser {
|
|||
throw new ConfigurationException("Failed to initialize STaX event factory", e);
|
||||
}
|
||||
|
||||
return parseResource(streamReader);
|
||||
}
|
||||
|
||||
public Bundle parseBundle(String theXml) throws ConfigurationException, DataFormatException {
|
||||
XMLEventReader streamReader;
|
||||
try {
|
||||
ParserState parserState = null;
|
||||
streamReader = myXmlInputFactory.createXMLEventReader(new StringReader(theXml));
|
||||
} catch (XMLStreamException e) {
|
||||
throw new DataFormatException(e);
|
||||
} catch (FactoryConfigurationError e) {
|
||||
throw new ConfigurationException("Failed to initialize STaX event factory", e);
|
||||
}
|
||||
|
||||
return parseBundle(streamReader);
|
||||
}
|
||||
|
||||
private Bundle parseBundle(XMLEventReader theStreamReader) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public IResource parseResource(XMLEventReader streamReader) {
|
||||
|
||||
try {
|
||||
ParserState parserState = ParserState.getPreResourceInstance(myContext);
|
||||
|
||||
while (streamReader.hasNext()) {
|
||||
XMLEvent nextEvent = streamReader.nextEvent();
|
||||
if (nextEvent.isStartElement()) {
|
||||
|
@ -400,9 +390,7 @@ public class XmlParser {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (parserState == null) {
|
||||
parserState = ParserState.getResourceInstance(myContext, elem.getName().getLocalPart());
|
||||
} else if ("extension".equals(elem.getName().getLocalPart())) {
|
||||
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");
|
||||
|
@ -428,9 +416,6 @@ public class XmlParser {
|
|||
if (!"value".equals(elem.getName().getLocalPart())) {
|
||||
continue;
|
||||
}
|
||||
if (parserState == null) {
|
||||
throw new DataFormatException("Detected attribute before element");
|
||||
}
|
||||
parserState.attributeValue(elem, elem.getValue());
|
||||
} else if (nextEvent.isEndElement()) {
|
||||
EndElement elem = nextEvent.asEndElement();
|
||||
|
@ -439,17 +424,12 @@ public class XmlParser {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (parserState == null) {
|
||||
throw new DataFormatException("Detected unexpected end-element");
|
||||
}
|
||||
parserState.endingElement(elem);
|
||||
if (parserState.isComplete()) {
|
||||
return (IResource) parserState.getObject();
|
||||
}
|
||||
} else {
|
||||
if (parserState != null) {
|
||||
parserState.otherEvent(nextEvent);
|
||||
}
|
||||
parserState.otherEvent(nextEvent);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -459,4 +439,36 @@ public class XmlParser {
|
|||
throw new DataFormatException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeAtomLink(XMLStreamWriter theEventWriter, String theRel, StringDt theStringDt) throws XMLStreamException {
|
||||
if (StringUtils.isNotBlank(theStringDt.getValue())) {
|
||||
theEventWriter.writeStartElement("link");
|
||||
theEventWriter.writeAttribute("rel", theRel);
|
||||
theEventWriter.writeAttribute("href", theStringDt.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
private void writeOptionalTagWithTextNode(XMLStreamWriter theEventWriter, String theTagName, InstantDt theInstantDt) throws XMLStreamException {
|
||||
if (theInstantDt.getValue() != null) {
|
||||
theEventWriter.writeStartElement(theTagName);
|
||||
theEventWriter.writeCharacters(theInstantDt.getValueAsString());
|
||||
theEventWriter.writeEndElement();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeOptionalTagWithTextNode(XMLStreamWriter theEventWriter, String theElementName, StringDt theTextValue) throws XMLStreamException {
|
||||
if (StringUtils.isNotBlank(theTextValue.getValue())) {
|
||||
theEventWriter.writeStartElement(theElementName);
|
||||
theEventWriter.writeCharacters(theTextValue.getValue());
|
||||
theEventWriter.writeEndElement();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeTagWithTextNode(XMLStreamWriter theEventWriter, String theElementName, StringDt theStringDt) throws XMLStreamException {
|
||||
theEventWriter.writeStartElement(theElementName);
|
||||
if (StringUtils.isNotBlank(theStringDt.getValue())) {
|
||||
theEventWriter.writeCharacters(theStringDt.getValue());
|
||||
}
|
||||
theEventWriter.writeEndElement();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,11 +15,76 @@ import org.xml.sax.SAXException;
|
|||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.ResourceWithExtensionsA;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.dstu.resource.Observation;
|
||||
import ca.uhn.fhir.model.dstu.resource.ValueSet;
|
||||
|
||||
public class XmlParserTest {
|
||||
|
||||
@Test
|
||||
public void testParseBundle() {
|
||||
|
||||
//@formatter:off
|
||||
String msg = "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n" +
|
||||
" <title>FHIR Core Valuesets</title>\n" +
|
||||
" <id>http://hl7.org/fhir/profile/valuesets</id>\n" +
|
||||
" <link href=\"http://hl7.org/implement/standards/fhir/valuesets.xml\" rel=\"self\"/>\n" +
|
||||
" <updated>2014-02-10T04:11:24.435-00:00</updated>\n" +
|
||||
" <entry>\n" +
|
||||
" <title>Valueset "256a5231-a2bb-49bd-9fea-f349d428b70d" to support automated processing</title>\n" +
|
||||
" <id>http://hl7.org/fhir/valueset/256a5231-a2bb-49bd-9fea-f349d428b70d</id>\n" +
|
||||
" <link href=\"http://hl7.org/implement/standards/fhir/valueset/256a5231-a2bb-49bd-9fea-f349d428b70d\" rel=\"self\"/>\n" +
|
||||
" <updated>2014-02-10T04:10:46.987-00:00</updated>\n" +
|
||||
" <author>\n" +
|
||||
" <name>HL7, Inc (FHIR Project)</name>\n" +
|
||||
" <uri>http://hl7.org/fhir</uri>\n" +
|
||||
" </author>\n" +
|
||||
" <published>2014-02-10T04:10:46.987-00:00</published>\n" +
|
||||
" <content type=\"text/xml\">\n" +
|
||||
" <ValueSet xmlns=\"http://hl7.org/fhir\">\n" +
|
||||
" <text>\n" +
|
||||
" <status value=\"generated\"/>" +
|
||||
" </text>\n" +
|
||||
" <identifier value=\"256a5231-a2bb-49bd-9fea-f349d428b70d\"/>\n" +
|
||||
" <version value=\"20120613\"/>\n" +
|
||||
" <name value=\"LOINC Codes for Cholesterol\"/>\n" +
|
||||
" <publisher value=\"FHIR project team (example)\"/>\n" +
|
||||
" <telecom>\n" +
|
||||
" <system value=\"url\"/>\n" +
|
||||
" <value value=\"http://hl7.org/fhir\"/>\n" +
|
||||
" </telecom>\n" +
|
||||
" <description value=\"This is an example value set that includes all the LOINC codes for serum cholesterol from v2.36\"/>\n" +
|
||||
" <status value=\"draft\"/>\n" +
|
||||
" <experimental value=\"true\"/>\n" +
|
||||
" <date value=\"2012-06-13\"/>\n" +
|
||||
" <compose>\n" +
|
||||
" <include>\n" +
|
||||
" <system value=\"http://loinc.org\"/>\n" +
|
||||
" <version value=\"2.36\"/>\n" +
|
||||
" <code value=\"14647-2\"/>\n" +
|
||||
" <code value=\"2093-3\"/>\n" +
|
||||
" <code value=\"35200-5\"/>\n" +
|
||||
" <code value=\"9342-7\"/>\n" +
|
||||
" </include>\n" +
|
||||
" </compose>\n" +
|
||||
" </ValueSet>\n" +
|
||||
" </content>\n" +
|
||||
" <summary type=\"xhtml\"><div xmlns=\"http://www.w3.org/1999/xhtml\">\n" +
|
||||
" <p>Value set "LOINC Codes for Cholesterol": This is an example value set that includes \n" +
|
||||
" all the LOINC codes for serum cholesterol from v2.36. \n" +
|
||||
" Developed by: FHIR project team (example)</p>\n" +
|
||||
" </summary>\n" +
|
||||
" </entry>" +
|
||||
"</feed>";
|
||||
//@formatter:on
|
||||
|
||||
XmlParser p = new FhirContext(ValueSet.class).newXmlParser();
|
||||
Bundle bundle = p.parseBundle(msg);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadAndEncodeExtensions() throws ConfigurationException, DataFormatException, SAXException, IOException {
|
||||
FhirContext ctx = new FhirContext(ResourceWithExtensionsA.class);
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<projectDescription>
|
||||
<name>hapi-fhirstarter-plugin</name>
|
||||
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
|
||||
<projects/>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -1,145 +0,0 @@
|
|||
package ca.uhn.fhir.starter;
|
||||
|
||||
|
||||
public class ResourceParser extends BaseParser {
|
||||
private String myResourceName;
|
||||
|
||||
private void setResourceName(String theString) {
|
||||
myResourceName = theString;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getFilename() {
|
||||
return myResourceName + "-spreadsheet.xml";
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected void parseBasicElements(Element theRowXml, BaseElement
|
||||
// theTarget) {
|
||||
// String name = cellValue(theRowXml, 0);
|
||||
// theTarget.setName(name);
|
||||
//
|
||||
// int lastDot = name.lastIndexOf('.');
|
||||
// if (lastDot == -1) {
|
||||
// theTarget.setElementName(name);
|
||||
// } else {
|
||||
// String elementName = name.substring(lastDot + 1);
|
||||
// String elementParentName = name.substring(0, lastDot);
|
||||
// theTarget.setElementName(elementName);
|
||||
// theTarget.setElementParentName(elementParentName);
|
||||
// }
|
||||
//
|
||||
// String cardValue = cellValue(theRowXml, 1);
|
||||
// if (cardValue != null && cardValue.contains("..")) {
|
||||
// String[] split = cardValue.split("\\.\\.");
|
||||
// theTarget.setCardMin(split[0]);
|
||||
// theTarget.setCardMax(split[1]);
|
||||
// }
|
||||
//
|
||||
// String type = cellValue(theRowXml, 5);
|
||||
// theTarget.setTypeFromString(type);
|
||||
//
|
||||
// theTarget.setBinding(cellValue(theRowXml, 6));
|
||||
// theTarget.setShortName(cellValue(theRowXml, 7));
|
||||
// theTarget.setDefinition(cellValue(theRowXml, 8));
|
||||
// theTarget.setRequirement(cellValue(theRowXml, 9));
|
||||
// theTarget.setV2Mapping(cellValue(theRowXml, 14));
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected String getTemplate() {
|
||||
return "/resource.vm";
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
ResourceParser p = new ResourceParser();
|
||||
// p.setDirectory("src/test/resources/res");
|
||||
// p.setResourceName("patient");
|
||||
// p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ResourceWithExtensionsA.java");
|
||||
// ArrayList<Extension> exts = new ArrayList<Extension>();
|
||||
// Extension ext1 = new Extension("foo1", "http://foo/1", "string");
|
||||
// exts.add(ext1);
|
||||
// Extension ext2 = new Extension("bar1", "http://bar/1", new Extension("bar11", "http://bar/1/1", "date"), new Extension("bar12", "http://bar/1/2", "date"));
|
||||
// exts.add(ext2);
|
||||
// p.setExtensions(exts);
|
||||
// p.parse();
|
||||
|
||||
|
||||
// p.setDirectory("src/test/resources/res");
|
||||
// p.setResourceName("medication");
|
||||
// p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Medication.java");
|
||||
// p.parse();
|
||||
//
|
||||
// p.setDirectory("src/test/resources/res");
|
||||
// p.setResourceName("substance");
|
||||
// p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Substance.java");
|
||||
// p.parse();
|
||||
|
||||
|
||||
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.parse();
|
||||
|
||||
// p = new ResourceParser();
|
||||
// p.setDirectory("src/test/resources/res");
|
||||
// p.setResourceName("observation");
|
||||
// p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Observation.java");
|
||||
// p.parse();
|
||||
//
|
||||
// p.setResourceName("profile");
|
||||
// p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Profile.java");
|
||||
// p.parse();
|
||||
//
|
||||
// p.setResourceName("device");
|
||||
// p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Device.java");
|
||||
// p.parse();
|
||||
//
|
||||
// p.setResourceName("group");
|
||||
// p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Group.java");
|
||||
// p.parse();
|
||||
//
|
||||
// p.setResourceName("location");
|
||||
// p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Location.java");
|
||||
// p.parse();
|
||||
//
|
||||
// p.setResourceName("organization");
|
||||
// p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Organization.java");
|
||||
// p.parse();
|
||||
//
|
||||
// p.setResourceName("patient");
|
||||
// p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Patient.java");
|
||||
// p.parse();
|
||||
//
|
||||
// p.setResourceName("specimen");
|
||||
// p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Specimen.java");
|
||||
// p.parse();
|
||||
//
|
||||
// p.setResourceName("practitioner");
|
||||
// p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Practitioner.java");
|
||||
// p.parse();
|
||||
//
|
||||
// DatatypeParser d = new DatatypeParser();
|
||||
// d.setDirectory("src/test/resources/dt");
|
||||
// d.setDatatypeName("humanname");
|
||||
// d.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/HumanNameDt.java");
|
||||
// d.parse();
|
||||
//
|
||||
// d.setDatatypeName("contact");
|
||||
// d.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ContactDt.java");
|
||||
// d.parse();
|
||||
//
|
||||
// d.setDatatypeName("address");
|
||||
// d.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/AddressDt.java");
|
||||
// d.parse();
|
||||
//
|
||||
// d.setDatatypeName("narrative");
|
||||
// d.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/NarrativeDt.java");
|
||||
// d.parse();
|
||||
//
|
||||
// d.setDatatypeName("quantity");
|
||||
// d.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/QuantityDt.java");
|
||||
// d.parse();
|
||||
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package ca.uhn.fhir.starter.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ResourceBlock extends Child {
|
||||
|
||||
@Override
|
||||
public List<BaseElement> getChildren() {
|
||||
return super.getChildren();
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return getElementName().substring(0,1).toUpperCase() + getElementName().substring(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSingleType() {
|
||||
return getClassName();
|
||||
}
|
||||
|
||||
public boolean isBlock() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeSuffix() {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package ca.uhn.fhir.starter.model;
|
||||
|
||||
public class ValueSet {
|
||||
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<ValueSet xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hl7.org/fhir ../../schema/valueset.xsd">
|
||||
<name value="Administrative Gender Codes"/>
|
||||
<publisher value="FHIR Project team"/>
|
||||
<telecom>
|
||||
<system value="url"/>
|
||||
<value value="http://hl7.org/fhir"/>
|
||||
</telecom>
|
||||
<description value="This value set defines the set of codes that can be used to indicate the administrative gender of a person"/>
|
||||
<status value="draft"/>
|
||||
<compose>
|
||||
<include>
|
||||
<system value="http://hl7.org/fhir/v3/AdministrativeGender"/>
|
||||
<code value="F"/>
|
||||
<code value="M"/>
|
||||
<code value="UN"/>
|
||||
</include>
|
||||
<include>
|
||||
<system value="http://hl7.org/fhir/v3/NullFlavor"/>
|
||||
<code value="UNK"/>
|
||||
</include>
|
||||
</compose>
|
||||
</ValueSet>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>hapi-tinder-plugin</name>
|
||||
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -9,7 +9,7 @@
|
|||
</parent>
|
||||
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhirstarter-plugin</artifactId>
|
||||
<artifactId>hapi-tinder-plugin</artifactId>
|
||||
<!--<packaging>maven-plugin</packaging> -->
|
||||
<packaging>jar</packaging>
|
||||
|
|
@ -24,6 +24,7 @@ import org.w3c.dom.Node;
|
|||
import org.w3c.dom.NodeList;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.SimpleSetter;
|
||||
import ca.uhn.fhir.starter.model.AnyChild;
|
||||
import ca.uhn.fhir.starter.model.BaseElement;
|
||||
import ca.uhn.fhir.starter.model.Child;
|
||||
import ca.uhn.fhir.starter.model.Extension;
|
||||
|
@ -76,6 +77,9 @@ public abstract class BaseParser {
|
|||
Map<String, BaseElement> elements = new HashMap<String, BaseElement>();
|
||||
elements.put(resource.getElementName(), resource);
|
||||
|
||||
// Map<String,String> blockFullNameToShortName = new HashMap<String,String>();
|
||||
|
||||
|
||||
for (int i = 2; i < rows.getLength(); i++) {
|
||||
Element nextRow = (Element) rows.item(i);
|
||||
String name = cellValue(nextRow, 0);
|
||||
|
@ -84,13 +88,15 @@ public abstract class BaseParser {
|
|||
}
|
||||
|
||||
String type = cellValue(nextRow, myColType);
|
||||
|
||||
|
||||
Child elem;
|
||||
if (StringUtils.isBlank(type) || type.startsWith("=")) {
|
||||
elem = new ResourceBlock();
|
||||
} else if (type.startsWith("@")) {
|
||||
type = type.substring(type.lastIndexOf('.')+1);
|
||||
// type = type.substring(type.lastIndexOf('.')+1);
|
||||
elem=new ResourceBlockCopy();
|
||||
} else if (type.equals("*")) {
|
||||
elem = new AnyChild();
|
||||
} else {
|
||||
elem = new Child();
|
||||
}
|
||||
|
@ -116,6 +122,9 @@ public abstract class BaseParser {
|
|||
write(resource);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void scanForSimpleSetters(Child theElem) {
|
||||
Class<?> childDt;
|
||||
|
@ -234,15 +243,8 @@ public abstract class BaseParser {
|
|||
String name = cellValue(theRowXml, myColName);
|
||||
theTarget.setName(name);
|
||||
|
||||
int lastDot = name.lastIndexOf('.');
|
||||
if (lastDot == -1) {
|
||||
theTarget.setElementName(name);
|
||||
} else {
|
||||
String elementName = name.substring(lastDot + 1);
|
||||
String elementParentName = name.substring(0, lastDot);
|
||||
theTarget.setElementName(elementName);
|
||||
theTarget.setElementParentName(elementParentName);
|
||||
}
|
||||
theTarget.setElementName(name);
|
||||
|
||||
|
||||
String cardValue = cellValue(theRowXml, myColCard);
|
||||
if (cardValue != null && cardValue.contains("..")) {
|
|
@ -0,0 +1,164 @@
|
|||
package ca.uhn.fhir.starter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ResourceParser extends BaseParser {
|
||||
private String myResourceName;
|
||||
|
||||
private List<String> myAllDatatypes;
|
||||
|
||||
private void setResourceName(String theString) {
|
||||
myResourceName = theString;
|
||||
}
|
||||
|
||||
public void setAllDatatypes(List<String> theAllDatatypes) {
|
||||
myAllDatatypes = theAllDatatypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getFilename() {
|
||||
return myResourceName + "-spreadsheet.xml";
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected void parseBasicElements(Element theRowXml, BaseElement
|
||||
// theTarget) {
|
||||
// String name = cellValue(theRowXml, 0);
|
||||
// theTarget.setName(name);
|
||||
//
|
||||
// int lastDot = name.lastIndexOf('.');
|
||||
// if (lastDot == -1) {
|
||||
// theTarget.setElementName(name);
|
||||
// } else {
|
||||
// String elementName = name.substring(lastDot + 1);
|
||||
// String elementParentName = name.substring(0, lastDot);
|
||||
// theTarget.setElementName(elementName);
|
||||
// theTarget.setElementParentName(elementParentName);
|
||||
// }
|
||||
//
|
||||
// String cardValue = cellValue(theRowXml, 1);
|
||||
// if (cardValue != null && cardValue.contains("..")) {
|
||||
// String[] split = cardValue.split("\\.\\.");
|
||||
// theTarget.setCardMin(split[0]);
|
||||
// theTarget.setCardMax(split[1]);
|
||||
// }
|
||||
//
|
||||
// String type = cellValue(theRowXml, 5);
|
||||
// theTarget.setTypeFromString(type);
|
||||
//
|
||||
// theTarget.setBinding(cellValue(theRowXml, 6));
|
||||
// theTarget.setShortName(cellValue(theRowXml, 7));
|
||||
// theTarget.setDefinition(cellValue(theRowXml, 8));
|
||||
// theTarget.setRequirement(cellValue(theRowXml, 9));
|
||||
// theTarget.setV2Mapping(cellValue(theRowXml, 14));
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected String getTemplate() {
|
||||
return "/resource.vm";
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
ResourceParser p = new ResourceParser();
|
||||
p.setAllDatatypes(new ArrayList<String>());
|
||||
p.setDirectory("src/test/resources/res");
|
||||
|
||||
// TODO: this needs to be properly populated
|
||||
p.getAllDatatypes().add("String");
|
||||
p.getAllDatatypes().add("Date");
|
||||
p.getAllDatatypes().add("DateTime");
|
||||
|
||||
// p.setDirectory("src/test/resources/res");
|
||||
// p.setResourceName("patient");
|
||||
// p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ResourceWithExtensionsA.java");
|
||||
// ArrayList<Extension> exts = new ArrayList<Extension>();
|
||||
// Extension ext1 = new Extension("foo1", "http://foo/1", "string");
|
||||
// exts.add(ext1);
|
||||
// Extension ext2 = new Extension("bar1", "http://bar/1", new Extension("bar11", "http://bar/1/1", "date"), new Extension("bar12", "http://bar/1/2", "date"));
|
||||
// exts.add(ext2);
|
||||
// p.setExtensions(exts);
|
||||
// p.parse();
|
||||
|
||||
|
||||
p.setResourceName("medication");
|
||||
p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Medication.java");
|
||||
p.parse();
|
||||
|
||||
p.setDirectory("src/test/resources/res");
|
||||
p.setResourceName("substance");
|
||||
p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Substance.java");
|
||||
p.parse();
|
||||
|
||||
|
||||
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.parse();
|
||||
|
||||
p.setDirectory("src/test/resources/res");
|
||||
p.setResourceName("observation");
|
||||
p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Observation.java");
|
||||
p.parse();
|
||||
|
||||
p.setResourceName("profile");
|
||||
p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Profile.java");
|
||||
p.parse();
|
||||
|
||||
p.setResourceName("device");
|
||||
p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Device.java");
|
||||
p.parse();
|
||||
|
||||
p.setResourceName("group");
|
||||
p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Group.java");
|
||||
p.parse();
|
||||
|
||||
p.setResourceName("location");
|
||||
p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Location.java");
|
||||
p.parse();
|
||||
|
||||
p.setResourceName("organization");
|
||||
p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Organization.java");
|
||||
p.parse();
|
||||
|
||||
p.setResourceName("patient");
|
||||
p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Patient.java");
|
||||
p.parse();
|
||||
|
||||
p.setResourceName("specimen");
|
||||
p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Specimen.java");
|
||||
p.parse();
|
||||
|
||||
p.setResourceName("practitioner");
|
||||
p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Practitioner.java");
|
||||
p.parse();
|
||||
|
||||
DatatypeParser d = new DatatypeParser();
|
||||
d.setDirectory("src/test/resources/dt");
|
||||
d.setDatatypeName("humanname");
|
||||
d.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/HumanNameDt.java");
|
||||
d.parse();
|
||||
|
||||
d.setDatatypeName("contact");
|
||||
d.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ContactDt.java");
|
||||
d.parse();
|
||||
|
||||
d.setDatatypeName("address");
|
||||
d.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/AddressDt.java");
|
||||
d.parse();
|
||||
|
||||
d.setDatatypeName("narrative");
|
||||
d.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/NarrativeDt.java");
|
||||
d.parse();
|
||||
|
||||
d.setDatatypeName("quantity");
|
||||
d.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/QuantityDt.java");
|
||||
d.parse();
|
||||
|
||||
}
|
||||
|
||||
private List<String> getAllDatatypes() {
|
||||
return myAllDatatypes;
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import org.apache.commons.io.IOUtils;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.dstu.resource.ValueSet;
|
||||
import ca.uhn.fhir.model.dstu.resource.ValueSet.DefineConcept;
|
||||
|
||||
public class ValueSetParser {
|
||||
|
||||
|
@ -19,7 +20,8 @@ public class ValueSetParser {
|
|||
|
||||
ValueSetParser p = new ValueSetParser();
|
||||
p.setDirectory("src/test/resources/vs/");
|
||||
p.setValueSetName("administrative-gender");
|
||||
// p.setBundle()
|
||||
// p.setValueSetName("administrative-gender");
|
||||
p.setOutputDirectory("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/");
|
||||
p.parse();
|
||||
|
||||
|
@ -27,16 +29,22 @@ public class ValueSetParser {
|
|||
|
||||
private void parse() throws FileNotFoundException, IOException {
|
||||
String string = IOUtils.toString(new FileReader(myDirectory + "valueset-" + myValueSetName + ".xml"));
|
||||
ValueSet res = (ValueSet) new FhirContext(ValueSet.class).newXmlParser().parseResource(string);
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setOutputDirectory(String theString) {
|
||||
myOutputDirectory=theString;
|
||||
}
|
||||
|
||||
private void setValueSetName(String theString) {
|
||||
myValueSetName = theString;
|
||||
}
|
||||
// private void setValueSetName(String theString) {
|
||||
// myValueSetName = theString;
|
||||
// }
|
||||
|
||||
public void setDirectory(String theString) {
|
||||
myDirectory = theString;
|
|
@ -0,0 +1,16 @@
|
|||
package ca.uhn.fhir.starter.model;
|
||||
|
||||
public class AnyChild extends Child {
|
||||
|
||||
@Override
|
||||
public String getTypeSuffix() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleChildInstantiable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -123,7 +123,15 @@ public abstract class BaseElement {
|
|||
}
|
||||
|
||||
public void setElementName(String theName) {
|
||||
myElementName = theName;
|
||||
int lastDot = theName.lastIndexOf('.');
|
||||
if (lastDot == -1) {
|
||||
myElementName= (theName);
|
||||
} else {
|
||||
String elementName = theName.substring(lastDot + 1);
|
||||
String elementParentName = theName.substring(0, lastDot);
|
||||
myElementName=(elementName);
|
||||
myElementParentName=(elementParentName);
|
||||
}
|
||||
}
|
||||
|
||||
public void setElementParentName(String theElementParentName) {
|
||||
|
@ -152,14 +160,24 @@ public abstract class BaseElement {
|
|||
typeString = typeString.substring("Resource(".length(), typeString.length() - 1);
|
||||
myResourceRef = true;
|
||||
}else if (typeString.startsWith("@")) {
|
||||
typeString = typeString.substring(typeString.lastIndexOf('.')+1);
|
||||
typeString = typeString.substring(1);
|
||||
typeString = ResourceBlock.convertFhirPathNameToClassName(typeString);
|
||||
} else if (typeString.equals("*")) {
|
||||
typeString = "IDatatype";
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(typeString)) {
|
||||
String[] types = typeString.replace("=", "").split("\\|");
|
||||
for (String nextType : types) {
|
||||
nextType = nextType.trim();
|
||||
nextType = nextType.substring(0, 1).toUpperCase() + nextType.substring(1);
|
||||
if (nextType.toLowerCase().startsWith("resource(")) {
|
||||
nextType = nextType.substring("Resource(".length(), nextType.length() - 1);
|
||||
nextType = nextType.substring(0, 1).toUpperCase() + nextType.substring(1);
|
||||
} else {
|
||||
nextType = nextType.substring(0, 1).toUpperCase() + nextType.substring(1);
|
||||
nextType = nextType + getTypeSuffix();
|
||||
}
|
||||
|
||||
if (isNotBlank(nextType)) {
|
||||
getType().add(nextType);
|
||||
}
|
||||
|
@ -168,6 +186,8 @@ public abstract class BaseElement {
|
|||
|
||||
}
|
||||
|
||||
public abstract String getTypeSuffix();
|
||||
|
||||
public void setV2Mapping(String theV2Mapping) {
|
||||
myV2Mapping = theV2Mapping;
|
||||
}
|
|
@ -22,6 +22,10 @@ public class Child extends BaseElement {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isSingleChildInstantiable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips off "[x]"
|
||||
*/
|
||||
|
@ -67,7 +71,8 @@ public class Child extends BaseElement {
|
|||
public List<String> getReferenceTypesForMultiple() {
|
||||
ArrayList<String> retVal = new ArrayList<String>();
|
||||
for (String next : getType()) {
|
||||
retVal.add(next + getTypeSuffix());
|
||||
retVal.add(next);
|
||||
// retVal.add(next + getTypeSuffix());
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
@ -93,15 +98,18 @@ public class Child extends BaseElement {
|
|||
String retVal;
|
||||
String elemName = this.getType().get(0);
|
||||
elemName = elemName.substring(0, 1).toUpperCase() + elemName.substring(1);
|
||||
if (this instanceof ResourceBlock) {
|
||||
// if (this instanceof ResourceBlock) {
|
||||
retVal = (elemName);
|
||||
} else {
|
||||
retVal = (elemName + getTypeSuffix());
|
||||
}
|
||||
// } else {
|
||||
// retVal = (elemName + getTypeSuffix());
|
||||
// }
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public String getTypeSuffix() {
|
||||
if (isResourceRef()) {
|
||||
return "";
|
||||
}
|
||||
return "Dt";
|
||||
}
|
||||
|
|
@ -3,4 +3,9 @@ package ca.uhn.fhir.starter.model;
|
|||
|
||||
public class Resource extends BaseElement {
|
||||
|
||||
@Override
|
||||
public String getTypeSuffix() {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package ca.uhn.fhir.starter.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ResourceBlock extends Child {
|
||||
|
||||
@Override
|
||||
public List<BaseElement> getChildren() {
|
||||
return super.getChildren();
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
// return getElementName().substring(0, 1).toUpperCase() + getElementName().substring(1);
|
||||
String name = getName();
|
||||
return convertFhirPathNameToClassName(name);
|
||||
}
|
||||
|
||||
public static String convertFhirPathNameToClassName(String name) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
boolean first=true;
|
||||
for (String next : name.split("\\.")) {
|
||||
if (first) {
|
||||
first=false;
|
||||
continue;
|
||||
}
|
||||
b.append(next.substring(0, 1).toUpperCase() + next.substring(1));
|
||||
}
|
||||
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getSingleType() {
|
||||
return getClassName();
|
||||
}
|
||||
|
||||
public boolean isBlock() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeSuffix() {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -45,7 +45,7 @@
|
|||
* </p>
|
||||
*/
|
||||
public ${child.referenceType} get${child.methodName}() {
|
||||
#if ( ${child.hasMultipleTypes} == false )
|
||||
#if ( ${child.hasMultipleTypes} == false && ${child.singleChildInstantiable} == true )
|
||||
if (${child.variableName} == null) {
|
||||
${child.variableName} = new ${child.referenceTypeForConstructor}();
|
||||
}
|
||||
|
@ -153,9 +153,11 @@
|
|||
|
||||
#childVars( $blockChild.children )
|
||||
#childAccessors( $blockChild.children )
|
||||
|
||||
}
|
||||
|
||||
#childResourceBlocks( $blockChild.resourceBlockChildren )
|
||||
|
||||
#end
|
||||
#end
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,121 @@
|
|||
<ValueSet xmlns="http://hl7.org/fhir">
|
||||
<text>
|
||||
<status value="generated" />
|
||||
<div xmlns="http://www.w3.org/1999/xhtml">
|
||||
<p>Release Date: 2013-12-07</p>
|
||||
|
||||
<h2>Description</h2>
|
||||
|
||||
<p>
|
||||
The gender of a person used for adminstrative purposes (as opposed
|
||||
to
|
||||
clinical gender)
|
||||
<br />
|
||||
|
||||
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<table class="grid">
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<b>Level</b>
|
||||
</td>
|
||||
<td>
|
||||
<b>Code</b>
|
||||
</td>
|
||||
<td>
|
||||
<b>Display</b>
|
||||
</td>
|
||||
<td>
|
||||
<b>Definition</b>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>
|
||||
F
|
||||
<a name="F">
|
||||
</a>
|
||||
</td>
|
||||
<td>Female</td>
|
||||
<td>
|
||||
Female
|
||||
<br />
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>
|
||||
M
|
||||
<a name="M">
|
||||
</a>
|
||||
</td>
|
||||
<td>Male</td>
|
||||
<td>
|
||||
Male
|
||||
<br />
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>
|
||||
UN
|
||||
<a name="UN">
|
||||
</a>
|
||||
</td>
|
||||
<td>Undifferentiated</td>
|
||||
<td>
|
||||
The gender of a person could not be uniquely defined as male or
|
||||
female, such as hermaphrodite.
|
||||
<br />
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</text>
|
||||
<identifier value="http://hl7.org/fhir/v3/vs/AdministrativeGender" />
|
||||
<name value="v3 Code System AdministrativeGender" />
|
||||
<publisher value="HL7, Inc" />
|
||||
<telecom>
|
||||
<system value="url" />
|
||||
<value value="http://hl7.org" />
|
||||
</telecom>
|
||||
<description
|
||||
value=" The gender of a person used for adminstrative purposes (as opposed to clinical gender)" />
|
||||
<status value="active" />
|
||||
<date value="2013-12-07T00:00:00+11:00" />
|
||||
<define>
|
||||
<system value="http://hl7.org/fhir/v3/AdministrativeGender" />
|
||||
<caseSensitive value="true" />
|
||||
<concept>
|
||||
<code value="F" />
|
||||
<display value="Female" />
|
||||
<definition value="Female" />
|
||||
</concept>
|
||||
<concept>
|
||||
<code value="M" />
|
||||
<display value="Male" />
|
||||
<definition value="Male" />
|
||||
</concept>
|
||||
<concept>
|
||||
<code value="UN" />
|
||||
<display value="Undifferentiated" />
|
||||
<definition
|
||||
value="The gender of a person could not be uniquely defined as male or female, such as hermaphrodite." />
|
||||
</concept>
|
||||
</define>
|
||||
</ValueSet>
|
Binary file not shown.
Loading…
Reference in New Issue