MRSFacility convertLocationToFacility(Location savedLocation) { return new OpenMRSFacility(String.valueOf(savedLocation.getId()), savedLocation.getName(), savedLocation.getCountry(), savedLocation.getAddress6(), savedLocation.getCountyDistrict(), savedLocation.getStateProvince()); }
+ (location == null ? "" : JavaScriptUtils.javaScriptEscape(location.getName())) + "\");\n"); sb.append("$j('#" + widgetFieldName + "_hid" + "').val(\"" + (location == null ? "" : JavaScriptUtils.javaScriptEscape(location.getId().toString())) + "\");\n"); sb.append("$j('#" + widgetFieldName + "').change();\n");
/** * @see {@link HtmlFormEntryUtil#getLocation(String)} mapping test */ @Test @Verifies(value = "should find a location by its name", method = "getLocation(String)") public void getLocation_shouldFindALocationByItsName() throws Exception { Assert.assertEquals("2", HtmlFormEntryUtil.getLocation("Xanadu").getId().toString()); }
/** * @see {@link HtmlFormEntryUtil#getLocation(String)} this is the id|name test */ @Test @Verifies(value = "should find a location by in Id|Name format", method = "getLocation(String)") public void getLocation_shouldFindALocationInIdNameFormat() throws Exception { Assert.assertEquals("2", HtmlFormEntryUtil.getLocation("2 - Xanadu").getId().toString()); }
Option option = new Option(label, location.getId().toString(), location.equals(defaultLocation)); locationOptions.add(option);
if (value instanceof Location) { Location location = (Location) value; obs.setValueText(location.getId().toString() + " - " + location.getName()); } else if (value instanceof Person) { Person person = (Person) value;
/** * @see {@link HtmlFormEntryUtil#getLocation(String, FormEntryContext)} */ @Test @Verifies(value = "should find a location by session attribute", method = "getLocation(String,FormEntrySession)") public void getLocation_shouldFindALocationBySessionAttribute() throws Exception { String attrName = "emr.sessionLocation"; MockHttpSession httpSession = new MockHttpSession(); httpSession.setAttribute(attrName, "2"); FormEntryContext formEntryContext = new FormEntryContext(FormEntryContext.Mode.ENTER); formEntryContext.setHttpSession(httpSession); Assert.assertEquals("2", HtmlFormEntryUtil.getLocation("SessionAttribute:" + attrName, formEntryContext).getId().toString()); }
@Test public void testLocation() throws Exception { VelocityFunctions functions = setupFunctionsForPatient(7); String locationIdIdentifier = new Integer(2).toString(); Assert.assertNotNull(functions.location(locationIdIdentifier)); Assert.assertEquals(locationIdIdentifier, functions.location(locationIdIdentifier).getId().toString()); String locationUuidIdentifier = "8d6c993e-c2cc-11de-8d13-0010c6dffd0f"; Assert.assertNotNull(functions.location(locationUuidIdentifier)); Assert.assertEquals(locationUuidIdentifier, functions.location(locationUuidIdentifier).getUuid()); String locationNameIdentifier = "Xanadu"; Assert.assertNotNull(functions.location(locationNameIdentifier)); Assert.assertEquals(locationNameIdentifier, functions.location(locationNameIdentifier).getName()); } }
Option option = new Option(location.getName(), location.getId().toString(), location.equals(defaultLocation)); locationOptions.add(option);
clearAndSetValue(obs, ObsType.TEXT, location.getId().toString()); obs.setComment("org.openmrs.Location"); rep = getResource().asRepresentation(getObject(), Representation.DEFAULT);