Search in sources :

Example 6 with FailureResult

use of org.openmrs.ui.framework.fragment.action.FailureResult in project openmrs-module-pihcore by PIH.

the class AccountFragmentController method unlock.

public FragmentActionResult unlock(@RequestParam("personId") Person person, @SpringBean("accountService") AccountService accountService, UiUtils ui) {
    try {
        AccountDomainWrapper account = accountService.getAccountByPerson(person);
        account.unlock();
        return new SuccessResult(ui.message("emr.account.unlocked.successMessage"));
    } catch (Exception e) {
        return new FailureResult(ui.message("emr.account.unlock.failedMessage"));
    }
}
Also used : FailureResult(org.openmrs.ui.framework.fragment.action.FailureResult) AccountDomainWrapper(org.openmrs.module.emrapi.account.AccountDomainWrapper) SuccessResult(org.openmrs.ui.framework.fragment.action.SuccessResult)

Aggregations

FailureResult (org.openmrs.ui.framework.fragment.action.FailureResult)6 SuccessResult (org.openmrs.ui.framework.fragment.action.SuccessResult)4 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 User (org.openmrs.User)2 VisitDomainWrapper (org.openmrs.module.emrapi.visit.VisitDomainWrapper)2 SimpleObject (org.openmrs.ui.framework.SimpleObject)2 List (java.util.List)1 JsonNode (org.codehaus.jackson.JsonNode)1 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1 DateTime (org.joda.time.DateTime)1 Obs (org.openmrs.Obs)1 Visit (org.openmrs.Visit)1 VisitAttributeType (org.openmrs.VisitAttributeType)1 APIException (org.openmrs.api.APIException)1 AccountDomainWrapper (org.openmrs.module.emrapi.account.AccountDomainWrapper)1 ExistingVisitDuringTimePeriodException (org.openmrs.module.emrapi.adt.exception.ExistingVisitDuringTimePeriodException)1 Diagnosis (org.openmrs.module.emrapi.diagnosis.Diagnosis)1 ObjectResult (org.openmrs.ui.framework.fragment.action.ObjectResult)1 Transactional (org.springframework.transaction.annotation.Transactional)1