Package org.openmrs

Examples of org.openmrs.PersonAddress


  }

  @Override
    public PersonAddress getValue(FormEntryContext context, HttpServletRequest request) {

    PersonAddress returnPersonAddress = new PersonAddress();

    returnPersonAddress.setAddress1(getWidgetValue("address1", context, request));
    returnPersonAddress.setAddress2(getWidgetValue("address2", context, request));
    returnPersonAddress.setCityVillage(getWidgetValue("cityVillage", context, request));
    returnPersonAddress.setStateProvince(getWidgetValue("stateProvince", context, request));
    returnPersonAddress.setPostalCode(getWidgetValue("postalCode", context, request));
    returnPersonAddress.setCountry(getWidgetValue("country", context, request));
    returnPersonAddress.setLatitude(getWidgetValue("latitude", context, request));
    returnPersonAddress.setLongitude(getWidgetValue("longitude", context, request));
    returnPersonAddress.setCountyDistrict(getWidgetValue("countyDistrict", context, request));
    returnPersonAddress.setNeighborhoodCell(getWidgetValue("neighborhoodCell", context, request));
    returnPersonAddress.setTownshipDivision(getWidgetValue("townshipDivision", context, request));
    returnPersonAddress.setSubregion(getWidgetValue("subregion", context, request));
    returnPersonAddress.setRegion(getWidgetValue("region", context, request));

    if (context.getMode() == Mode.EDIT) {
      PersonAddress preferedAddress = context.getExistingPatient().getPersonAddress();
      if (preferedAddress != null && returnPersonAddress.equalsContent(preferedAddress)) {
        returnPersonAddress = preferedAddress;
      }
    }
View Full Code Here


     
      @Override
      public void testResults(SubmissionResults results) {
        results.assertNoErrors();
        results.assertPatient();
        PersonAddress address = results.getPatient().getPersonAddress();
        Assert.assertEquals("410 w 10th St.", address.getAddress1());
        Assert.assertEquals("Indianapolis", address.getCityVillage());
        Assert.assertEquals("Indiana", address.getStateProvince());
        Assert.assertEquals("46202", address.getPostalCode());
        results.assertNoEncounterCreated();
      }
    }.run();
  }
View Full Code Here

     
      @Override
      public void testResults(SubmissionResults results) {
        results.assertNoErrors();
        results.assertPatient();
        PersonAddress address = results.getPatient().getPersonAddress();
        Assert.assertEquals("410 w 10th St.", address.getAddress1());
        Assert.assertEquals("Indianapolis", address.getCityVillage());
        Assert.assertEquals("Indiana", address.getStateProvince());
        Assert.assertEquals("46202", address.getPostalCode());
        results.assertNoEncounterCreated();
      }
     
      @Override
      public void setupEditRequest(MockHttpServletRequest request, Map<String, String> widgets) {
        request.addParameter(widgets.get("Location.address1"), "273 Beaver Dam Rd.");
        request.addParameter(widgets.get("Location.cityVillage"), "Scituate");
        request.addParameter(widgets.get("Location.stateProvince"), "MA");
        request.addParameter(widgets.get("Location.postalCode"), "02066")
      }
     
      @Override
      public void testEditedResults(SubmissionResults results) {
        results.assertNoErrors();
        results.assertPatient();
        PersonAddress address = results.getPatient().getPersonAddress();
        Assert.assertEquals("273 Beaver Dam Rd.", address.getAddress1());
        Assert.assertEquals("Scituate", address.getCityVillage());
        Assert.assertEquals("MA", address.getStateProvince());
        Assert.assertEquals("02066", address.getPostalCode());
        results.assertNoEncounterCreated();
      }
     
    }.run();
  }
View Full Code Here

      patientIdentifier.setPreferred(true);

    }

    if (addressWidget != null) {
      PersonAddress personAddress = (PersonAddress) addressWidget.getValue(context, request);
      if (context.getMode() == Mode.EDIT) {
        if (!personAddress.isPreferred()) {
          PersonAddress currentPreferredAddress = context.getExistingPatient().getPersonAddress();
          currentPreferredAddress.setPreferred(false);
          currentPreferredAddress.setVoided(true);
        }
      }
      personAddress.setPreferred(true);
      patient.addAddress(personAddress);
    }
View Full Code Here

    for (PersonAttributeType type : Context.getPersonService().getAllPersonAttributeTypes()) {
      if (type.getFormat() != null && type.getFormat().equals("java.lang.String")) {
        demo.addAttribute(new PersonAttribute(type, "Test " + type.getName() + " Attribute"));
      }
    }
    PersonAddress addr = new PersonAddress();
    addr.setCityVillage("Rwinkwavu");
    addr.setCountyDistrict("Kayonza District");
    addr.setStateProvince("Eastern Province");
    addr.setCountry("Rwanda");
    demo.addAddress(addr);
    return demo;
  }
View Full Code Here

   * Adds the address to the given person from the post object
   */
  private Person addAddresses(Person p, SimpleObject post) throws ResponseException {
    List<LinkedHashMap> addressObjects = (List<LinkedHashMap>) post.get("addresses");
    for (int i = 0; i < addressObjects.size(); i++) {
      PersonAddress pa = new PersonAddress();
      if (i == 0) {
        pa.setPreferred(Boolean.TRUE);
      }
      if (addressObjects.get(i).get("address1") != null) {
        pa.setAddress1(addressObjects.get(i).get("address1").toString());
      }
      if (addressObjects.get(i).get("address2") != null) {
        pa.setAddress2(addressObjects.get(i).get("address2").toString());
      }
      if (addressObjects.get(i).get("address3") != null) {
        pa.setAddress3(addressObjects.get(i).get("address3").toString());
      }
      if (addressObjects.get(i).get("cityVillage") != null) {
        pa.setCityVillage(addressObjects.get(i).get("cityVillage").toString());
      }
      if (addressObjects.get(i).get("stateProvince") != null) {
        pa.setStateProvince(addressObjects.get(i).get("stateProvince").toString());
      }
      p.addAddress(pa);
    }
    return p;
  }
View Full Code Here

TOP

Related Classes of org.openmrs.PersonAddress

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.