/** * @see org.openmrs.Attributable#getPossibleValues() */ @Override public List<Location> getPossibleValues() { try { return Context.getLocationService().getAllLocations(); } catch (Exception e) { return Collections.emptyList(); } }
/** * @see LocationService#getAllLocations() */ @Test public void getAllLocations_shouldReturnAllLocationsIncludingRetired() { List<Location> locations = Context.getLocationService().getAllLocations(); Assert.assertEquals(6, locations.size()); }
/** * @see LocationService#getAllLocations(null) */ @Test public void getAllLocations_shouldReturnAllLocationsWhenIncludeRetiredIsTrue() { List<Location> locations = Context.getLocationService().getAllLocations(true); Assert.assertEquals(6, locations.size()); }
/** * @see LocationService#getAllLocations(null) */ @Test public void getAllLocations_shouldReturnOnlyUnretiredLocationsWhenIncludeRetiresIsFalse() { List<Location> locations = Context.getLocationService().getAllLocations(false); Assert.assertEquals(5, locations.size()); }
/** * @see LocationService#getAllLocations(null) */ @Test public void getAllLocations_shouldPushRetiredLocationsToTheEndOfTheListWhenIncludeRetiredIsTrue() { LocationService ls = Context.getLocationService(); //retire the first location ls.retireLocation(ls.getAllLocations().get(0), "Just Testing"); // Get all locations. List<Location> locations = ls.getAllLocations(); //The 2 retired locations should be always be at the end Assert.assertTrue("Retired locations should be at the end of the list", locations.get(locations.size() - 1) .getRetired()); Assert.assertTrue("Retired locations should be at the end of the list", locations.get(locations.size() - 2) .getRetired()); }
List<Location> locationsBeforeRetired = ls.getAllLocations(true); List<Location> locationsNotRetiredBefore = ls.getAllLocations(false); List<Location> locationsAfterRetired = ls.getAllLocations(true); List<Location> locationsNotRetiredAfter = ls.getAllLocations(false);
coremetadatas.put("concept_class", Context.getConceptService().getAllConceptClasses(true)); coremetadatas.put("patient_identifier_type", Context.getPatientService().getAllPatientIdentifierTypes(true)); coremetadatas.put("location", Context.getLocationService().getAllLocations(true)); coremetadatas.put("hl7_source", Context.getHL7Service().getAllHL7Sources());
/** * Gets all the Facilities in OpenMRS * * @return List of all Facilities */ @Override public List<MRSFacility> getFacilities() { List<Location> locations = locationService.getAllLocations(); List<MRSFacility> facilities = new ArrayList<MRSFacility>(); for (Location location : locations) { facilities.add(convertLocationToFacility(location)); } return facilities; }
List<Location> locations = Context.getLocationService().getAllLocations(); Assert.assertTrue(CollectionUtils.isNotEmpty(locations));
/** * @see org.openmrs.module.webservices.rest.web.v1_0.controller.MainResourceControllerTest#getAllCount() */ @Override public long getAllCount() { return service.getAllLocations(false).size(); }
/** * @see org.openmrs.module.webservices.rest.web.v1_0.controller.MainResourceControllerTest#getAllCount() */ @Override public long getAllCount() { return service.getAllLocations(false).size(); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#doGetAll(org.openmrs.module.webservices.rest.web.RequestContext) */ @Override protected NeedsPaging<Location> doGetAll(RequestContext context) { return new NeedsPaging<Location>(Context.getLocationService().getAllLocations(context.getIncludeAll()), context); }
useLocations = options; } else { useLocations = Context.getLocationService().getAllLocations(); Collections.sort(useLocations, new Comparator<Location>() {
(locationList != null && locationList.size()<1)){ locationList = Context.getLocationService().getAllLocations();
locations = Context.getLocationService().getAllLocations(false);
Patient demo = new Patient(12345); demo.addName(new PersonName("Demo", "The", "Person")); Location l = Context.getLocationService().getAllLocations().iterator().next(); for (PatientIdentifierType pit : Context.getPatientService().getAllPatientIdentifierTypes()) { if (StringUtils.isEmpty(pit.getValidator())) {
/** * @verifies return location by tag uuid * @see LocationSearchHandler#getSearchConfig() */ @Test public void getSearchConfig_shouldReturnLocationByTagUuid() throws Exception { MockHttpServletRequest req = request(RequestMethod.GET, getURI()); req.addParameter("tag", "0940c6d4-47ed-11df-bc8b-001e378eb67e"); SimpleObject result = deserialize(handle(req)); List<Object> hits = (List<Object>) result.get("results"); Assert.assertEquals(2, hits.size()); List<Location> locations = service.getAllLocations(); Assert.assertEquals(service.getLocation(1).getUuid(), PropertyUtils.getProperty(hits.get(0), "uuid")); Assert.assertEquals(service.getLocation(2).getUuid(), PropertyUtils.getProperty(hits.get(1), "uuid")); }
for(Location location:Context.getLocationService().getAllLocations()) { Option option = new Option(location.getName(), location.getId().toString(), location.equals(defaultLocation)); locationOptions.add(option);
@Test public void setValue_shouldSetProperAttributableIdIfFound() { PersonAttributeType type = new PersonAttributeType(); type.setFormat("org.openmrs.Location"); type.setName("Second Home"); type.setDescription("Testing Attributable domain objects"); type.setSortWeight(5.5); type.setSearchable(false); type = personService.savePersonAttributeType(type); //Get the first location in from the list Location location = locationService.getAllLocations().get(0); PersonAttribute attribute = new PersonAttribute(type, null); attribute.setAttributeType(type); Assert.assertNull(attribute.getValue()); resource.setValue(attribute, location.getUuid()); Assert.assertEquals(location.getUuid(), attribute.getValue()); }