@Test public void getProvider_shouldGetFirstProviderWithUnknownRole() { Provider provider1 = Context.getProviderService().getProvider(1); Encounter enc3 = Context.getEncounterService().getEncounter(3); EncounterWrapper wrapped = new EncounterWrapper(enc3); Assert.assertThat(wrapped.getProvider(), is(provider1)); Assert.assertThat(new EncounterWrapper(new Encounter()).getProvider(), nullValue()); }
public Provider getProvider() { EncounterRole unknownRole = MetadataUtils.existing(EncounterRole.class, EncounterRole.UNKNOWN_ENCOUNTER_ROLE_UUID); Set<Provider> providers = target.getProvidersByRole(unknownRole); return providers.size() > 0 ? providers.iterator().next() : null; }
EncounterWrapper extends AbstractObjectWrapper<Encounter> { public Provider getProvider() { EncounterRole unknownRole = MetadataUtils.existing(EncounterRole.class, EncounterRole.UNKNOWN_ENCOUNTER_ROLE_UUID); Set<Provider> providers = target.getProvidersByRole(unknownRole); return providers.size() > 0 ? providers.iterator().next() : null; } }
EncounterWrapper extends AbstractObjectWrapper<Encounter> { public Provider getProvider() { EncounterRole unknownRole = MetadataUtils.existing(EncounterRole.class, EncounterRole.UNKNOWN_ENCOUNTER_ROLE_UUID); Set<Provider> providers = target.getProvidersByRole(unknownRole); return providers.size() > 0 ? providers.iterator().next() : null; } EncounterWrapper(Encounter target); }
EncounterWrapper extends AbstractObjectWrapper<Encounter> { public Provider getProvider() { EncounterRole unknownRole = MetadataUtils.existing(EncounterRole.class, EncounterRole.UNKNOWN_ENCOUNTER_ROLE_UUID); Set<Provider> providers = target.getProvidersByRole(unknownRole); return providers.size() > 0 ? providers.iterator().next() : null; } EncounterWrapper(Encounter target); Obs firstObs(Concept concept); List<Obs> allObs(Concept concept); Provider getProvider(); void setProvider(Provider provider); }
EncounterWrapper extends AbstractObjectWrapper<Encounter> { public Provider getProvider() { EncounterRole unknownRole = MetadataUtils.existing(EncounterRole.class, EncounterRole.UNKNOWN_ENCOUNTER_ROLE_UUID); Set<Provider> providers = target.getProvidersByRole(unknownRole); return providers.size() > 0 ? providers.iterator().next() : null; } EncounterWrapper(Encounter target); Obs firstObs(Concept concept); List<Obs> allObs(Concept concept); Provider getProvider(); void setProvider(Provider provider);  }