Search in sources :

Example 1 with AjaxMethod

use of org.sklsft.commons.mvc.annotations.AjaxMethod in project skeleton-commons by skeleton-software-community.

the class AjaxMethodAspect method execute.

@Around("ajaxMethods()")
public void execute(ProceedingJoinPoint joinPoint) throws Throwable {
    Method proxiedMethod = ((MethodSignature) joinPoint.getSignature()).getMethod();
    AjaxMethod ajaxMethod = proxiedMethod.getAnnotation(AjaxMethod.class);
    String value = ajaxMethod.value();
    try {
        logger.info(value);
        joinPoint.proceed();
        messageHandler.displayInfo(value + ".success");
        logger.info("completed");
    } catch (ApplicationException e) {
        messageHandler.displayError(e.getMessage());
        logger.error("failed : " + e.getClass().getSimpleName() + " - " + e.getMessage(), e);
    } catch (Exception e) {
        messageHandler.displayError(value + ".failure");
        logger.error("failed : " + e.getClass().getSimpleName() + " - " + e.getMessage(), e);
    }
}
Also used : ApplicationException(org.sklsft.commons.api.exception.ApplicationException) MethodSignature(org.aspectj.lang.reflect.MethodSignature) AjaxMethod(org.sklsft.commons.mvc.annotations.AjaxMethod) AjaxMethod(org.sklsft.commons.mvc.annotations.AjaxMethod) Method(java.lang.reflect.Method) ApplicationException(org.sklsft.commons.api.exception.ApplicationException) Around(org.aspectj.lang.annotation.Around)

Aggregations

Method (java.lang.reflect.Method)1 Around (org.aspectj.lang.annotation.Around)1 MethodSignature (org.aspectj.lang.reflect.MethodSignature)1 ApplicationException (org.sklsft.commons.api.exception.ApplicationException)1 AjaxMethod (org.sklsft.commons.mvc.annotations.AjaxMethod)1