@Test public void getSourceForm_shouldReturnTheSourceFormIfThereIsOne() { Patient patient = Context.getPatientService().getPatient(8); VisitType outpatient = MetadataUtils.existing(VisitType.class, CommonMetadata._VisitType.OUTPATIENT); Visit visit = TestUtils.saveVisit(patient, outpatient, TestUtils.date(2011, 1, 1), null); Assert.assertThat(new VisitWrapper(visit).getSourceForm(), is(nullValue())); Form ceForm = MetadataUtils.existing(Form.class, CommonMetadata._Form.CLINICAL_ENCOUNTER); VisitAttribute sourceAttr = new VisitAttribute(); sourceAttr.setAttributeType(MetadataUtils.existing(VisitAttributeType.class, CommonMetadata._VisitAttributeType.SOURCE_FORM)); sourceAttr.setOwner(visit); sourceAttr.setValue(ceForm); visit.addAttribute(sourceAttr); Context.getVisitService().saveVisit(visit); Assert.assertThat(new VisitWrapper(visit).getSourceForm(), is(ceForm)); }
public Form getSourceForm() { return (Form) getAsAttribute(CommonMetadata._VisitAttributeType.SOURCE_FORM); }
VisitWrapper extends AbstractCustomizableWrapper<Visit, VisitAttribute> { public Form getSourceForm() { return (Form) getAsAttribute(CommonMetadata._VisitAttributeType.SOURCE_FORM); } }
VisitWrapper extends AbstractCustomizableWrapper<Visit, VisitAttribute> { public Form getSourceForm() { return (Form) getAsAttribute(CommonMetadata._VisitAttributeType.SOURCE_FORM); } VisitWrapper(Visit target); }
VisitWrapper extends AbstractCustomizableWrapper<Visit, VisitAttribute> { public Form getSourceForm() { return (Form) getAsAttribute(CommonMetadata._VisitAttributeType.SOURCE_FORM); } VisitWrapper(Visit target); boolean overlaps(); Form getSourceForm(); }
VisitWrapper extends AbstractCustomizableWrapper<Visit, VisitAttribute> { public Form getSourceForm() { return (Form) getAsAttribute(CommonMetadata._VisitAttributeType.SOURCE_FORM); } VisitWrapper(Visit target); boolean overlaps(); Form getSourceForm();  }