for (PersonAddress pAddress : person.getAddresses()) { if (pAddress.isBlank()){ person.removeAddress(pAddress); continue;
.getAddresses().size() == 3); p.removeAddress(pa3); assertTrue("There should be only 2 address in the person object now", p.getAddresses().size() == 2); p.removeAddress(pa3); assertTrue("There should be only 2 address in the person object now", p.getAddresses().size() == 2); p.removeAddress(pa2); assertTrue("There should be only 1 address in the person object now", p.getAddresses().size() == 1); p.removeAddress(pa2); assertTrue("There should still be only 1 address in the person object now", p.getAddresses().size() == 1); p.removeAddress(pa1); assertTrue("There shouldn't be any addresses in the person object now", p.getAddresses().size() == 0);
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#purge(java.lang.Object, * org.openmrs.module.webservices.rest.web.RequestContext) */ @Override public void purge(PersonAddress address, RequestContext context) throws ResponseException { ///API has no void methods as of 1.8 and earlier versios, //we should be calling voidPersonAddress(PersonAddress, Reason) that was added in 1.9 address.getPerson().removeAddress(address); Context.getPersonService().savePerson(address.getPerson()); }