Search in sources :

Example 16 with AfterReturning

use of org.aspectj.lang.annotation.AfterReturning in project motan by weibocom.

the class LoggingAspect method logAfter.

@AfterReturning(value = "anyPublicOperation() && execCommandOperation()", returning = "result")
public void logAfter(JoinPoint joinPoint, boolean result) {
    Object[] args = joinPoint.getArgs();
    OperationRecord record = new OperationRecord();
    record.setOperator(getUsername());
    record.setType(joinPoint.getSignature().getName());
    record.setGroupName(args[0].toString());
    record.setCommand(JSON.toJSONString(args[1]));
    int status = result ? 1 : 0;
    record.setStatus((byte) status);
    if (recordMapper == null) {
        LoggerUtil.accessLog(JSON.toJSONString(record));
    } else {
        recordMapper.insertSelective(record);
    }
}
Also used : OperationRecord(com.weibo.model.OperationRecord) JoinPoint(org.aspectj.lang.JoinPoint) AfterReturning(org.aspectj.lang.annotation.AfterReturning)

Aggregations

AfterReturning (org.aspectj.lang.annotation.AfterReturning)16 UserDetails (com.agiletec.aps.system.services.user.UserDetails)4 AbstractUser (com.agiletec.aps.system.services.user.AbstractUser)2 User (com.topcom.cms.domain.User)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 JoinPoint (org.aspectj.lang.JoinPoint)2 IUserProfile (org.entando.entando.aps.system.services.userprofile.model.IUserProfile)2 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)2 ValidateAnnotation (com.paascloud.core.annotation.ValidateAnnotation)1 BaseEntityModel (com.topcom.cms.base.model.BaseEntityModel)1 LoginLog (com.topcom.cms.domain.LoginLog)1 OperationLog (com.topcom.cms.domain.OperationLog)1 OperationRecord (com.weibo.model.OperationRecord)1 Method (java.lang.reflect.Method)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 HashSet (java.util.HashSet)1 AfterThrowing (org.aspectj.lang.annotation.AfterThrowing)1 Profile (org.craftercms.profile.api.Profile)1 Authentication (org.craftercms.security.authentication.Authentication)1 DefaultAuthentication (org.craftercms.security.authentication.impl.DefaultAuthentication)1