Search in sources :

Example 1 with AccountDomainWrapper

use of org.openmrs.module.emrapi.account.AccountDomainWrapper in project openmrs-module-mirebalais by PIH.

the class MirebalaisHospitalActivatorComponentTest method verifyMirebalaisProviderIdentifierGeneratorConfigured.

private void verifyMirebalaisProviderIdentifierGeneratorConfigured() {
    Person person = Context.getPersonService().getPerson(2);
    AccountDomainWrapper account = accountService.getAccountByPerson(person);
    accountService.saveAccount(account);
    assertEquals("MCEPM", account.getProvider().getIdentifier());
}
Also used : AccountDomainWrapper(org.openmrs.module.emrapi.account.AccountDomainWrapper) Person(org.openmrs.Person)

Example 2 with AccountDomainWrapper

use of org.openmrs.module.emrapi.account.AccountDomainWrapper in project openmrs-module-coreapps by openmrs.

the class EditProviderPageController method getAccount.

public AccountDomainWrapper getAccount(@RequestParam(value = "personId", required = false) Person person, @RequestParam(value = "personUuid", required = false) String personUuid, @SpringBean("accountService") AccountService accountService) {
    AccountDomainWrapper account;
    Person newPerson = person;
    if (newPerson == null) {
        if (StringUtils.isNotBlank(personUuid)) {
            newPerson = Context.getPersonService().getPersonByUuid(personUuid);
        }
        if (newPerson == null) {
            newPerson = new Person();
        }
    }
    account = accountService.getAccountByPerson(newPerson);
    if (account == null)
        throw new APIException("Failed to find user account matching person with id:" + person.getPersonId());
    return account;
}
Also used : APIException(org.openmrs.api.APIException) AccountDomainWrapper(org.openmrs.module.emrapi.account.AccountDomainWrapper) Person(org.openmrs.Person)

Aggregations

Person (org.openmrs.Person)2 AccountDomainWrapper (org.openmrs.module.emrapi.account.AccountDomainWrapper)2 APIException (org.openmrs.api.APIException)1