Search in sources :

Example 6 with ApprovalMethod

use of org.mifos.rest.approval.domain.ApprovalMethod in project head by mifos.

the class StandardApprovalService method approve.

@Transactional
@Override
public Object approve(Long id) throws Exception {
    RESTApprovalEntity entity = approvalDao.getDetails(id);
    ApprovalMethod am = entity.getApprovalMethod();
    Object result = null;
    try {
        result = excuteMethod(am);
        entity.setState(ApprovalState.APPROVED);
    } catch (Exception e) {
        skipCreate = false;
        result = "Error : " + interceptError(e);
    }
    entity.setApprovedBy(getCurrentUserId());
    entity.setApprovedOn(new DateTime());
    approvalDao.update(entity);
    return result;
}
Also used : RESTApprovalEntity(org.mifos.rest.approval.domain.RESTApprovalEntity) ApprovalMethod(org.mifos.rest.approval.domain.ApprovalMethod) InvocationTargetException(java.lang.reflect.InvocationTargetException) DateTime(org.joda.time.DateTime) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ApprovalMethod (org.mifos.rest.approval.domain.ApprovalMethod)6 MethodArgHolder (org.mifos.rest.approval.domain.MethodArgHolder)4 Method (java.lang.reflect.Method)3 BeforeClass (org.junit.BeforeClass)2 ConfigurationServiceFacade (org.mifos.config.servicefacade.ConfigurationServiceFacade)2 ApprovalService (org.mifos.rest.approval.service.ApprovalService)2 RESTCallInterruptException (org.mifos.rest.approval.service.RESTCallInterruptException)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 RequestMethod (org.springframework.web.bind.annotation.RequestMethod)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Signature (org.aspectj.lang.Signature)1 Around (org.aspectj.lang.annotation.Around)1 MethodSignature (org.aspectj.lang.reflect.MethodSignature)1 DateTime (org.joda.time.DateTime)1 RESTApprovalEntity (org.mifos.rest.approval.domain.RESTApprovalEntity)1 ParameterNameDiscoverer (org.springframework.core.ParameterNameDiscoverer)1 Transactional (org.springframework.transaction.annotation.Transactional)1