Merge branch 'master' of github.com:jamesagnew/hapi-fhir
This commit is contained in:
commit
9c3ce5be86
|
@ -38,7 +38,7 @@ public @interface ResourceDef {
|
|||
String name() default "";
|
||||
|
||||
/**
|
||||
* Not currently used
|
||||
* if set, will be used as the id for any profiles generated for this resource
|
||||
*/
|
||||
String id() default "";
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package ca.uhn.fhir.context;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.api.annotation.Extension;
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
import ca.uhn.fhir.model.dstu.resource.Observation;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
|
||||
/**
|
||||
* Created by Bill de Beaubien on 10/31/2014.
|
||||
*/
|
||||
@ResourceDef(name="Observation", id="customobservation")
|
||||
public class CustomObservation extends Observation {
|
||||
@Child(name = "valueUnits", order = 3)
|
||||
@Extension(url = "http://hapi.test.com/profile/customobservation#valueUnits", definedLocally = true, isModifier = false)
|
||||
@Description(shortDefinition = "Units on an observation whose type is of valueString")
|
||||
private StringDt myValueUnits;
|
||||
|
||||
public StringDt getValueUnits() {
|
||||
if (myValueUnits == null) {
|
||||
myValueUnits = new StringDt();
|
||||
}
|
||||
return myValueUnits;
|
||||
}
|
||||
|
||||
public void setValueUnits(StringDt theValueUnits) {
|
||||
myValueUnits = theValueUnits;
|
||||
}
|
||||
}
|
|
@ -92,4 +92,14 @@ public class RuntimeResourceDefinitionTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProfileIdIsActualResourceName() {
|
||||
FhirContext ctx = new FhirContext(CustomObservation.class);
|
||||
RuntimeResourceDefinition def = ctx.getResourceDefinition(CustomObservation.class);
|
||||
|
||||
Profile profile = (Profile) def.toProfile();
|
||||
|
||||
assertEquals("customobservation", profile.getId().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue