Java 类org.aspectj.lang.annotation.AfterReturning 实例源码

项目:devops-cstack    文件:ServerAspect.java   
@AfterReturning(pointcut = "execution(* cn.org.once.cstack.ServerService.create(..)) "
        + "|| execution(* cn.org.once.cstack.ServerService.updateType(..))", returning = "result")
public void afterReturningServer(StaticPart staticPart, Object result) throws MonitorException {
    try {
        if (result == null)
            return;
        Server server = (Server) result;
        User user = server.getApplication().getUser();
        Message message = null;
        switch (staticPart.getSignature().getName().toUpperCase()) {
        case createType:
            message = MessageUtils.writeServerMessage(user, server, createType);
            break;
        case updateType:
            message = MessageUtils.writeServerMessage(user, server, updateType);
            break;

        }
        logger.info(message.toString());
        messageService.create(message);

    } catch (ServiceException e) {
        throw new MonitorException("Error afterReturningApplication", e);
    }
}
项目:devops-cstack    文件:FileExplorerAspect.java   
@AfterReturning("execution(* cn.org.once.cstack.service.FileService.deleteFilesFromContainer(..))"
        + " || execution(* cn.org.once.cstack.service.FileService.sendFileToContainer(..))")
public void afterReturningFileExplorer(JoinPoint joinPoint) throws ServiceException {
    Message message = new Message();
    User user = getAuthentificatedUser();
    message.setDate(new Date());
    message.setType(Message.INFO);
    message.setAuthor(user);
    message.setApplicationName((String) joinPoint.getArgs()[0]);

    switch (joinPoint.getSignature().getName().toUpperCase()) {
    case "DELETEFILESFROMCONTAINER":
        message.setEvent(user.getLogin() + " has removed this file : " + joinPoint.getArgs()[2]);
        break;
    }
    this.messageService.create(message);
}
项目:devops-cstack    文件:DeploymentAspect.java   
@AfterReturning(pointcut = "execution(* cn.org.once.cstack.service.DeploymentService.create(..))", returning = "result")
public void afterReturningDeployment(StaticPart staticPart, Object result)
    throws MonitorException {
    try {
        if (result == null)
            return;
        Deployment deployment = (Deployment) result;
        User user = deployment.getApplication().getUser();
        Message message = null;
        switch (staticPart.getSignature().getName().toUpperCase()) {
            case createType:
                message = MessageUtils.writeDeploymentMessage(user, deployment,
                    createType);
                break;
        }

        if (message != null) {
            logger.info(message.toString());
            messageService.create(message);
        }

    } catch (ServiceException e) {
        throw new MonitorException("Error afterReturningApplication", e);

    }
}
项目:dhus-core    文件:CacheAspectDefinition.java   
@AfterReturning ("@annotation(fr.gael.dhus.spring.cache.IncrementCache)")
public void updateCache (JoinPoint joinPoint)
{
   IncrementCache annotation = ((MethodSignature) joinPoint.getSignature ())
         .getMethod ().getAnnotation (IncrementCache.class);

   Cache cache = getCacheManager().getCache(annotation.name());
   if (cache != null)
   {
      synchronized (cache)
      {
         Integer old_value = cache.get (annotation.key (), Integer.class);
         cache.clear ();
         if (old_value == null)
         {
            return;
         }
         cache.put (annotation.key (), (old_value + annotation.value ()));
      }
   }
}
项目:webside    文件:LogAspect.java   
/**
 * 管理员删除操作日志(后置通知)
 * 
 */
@AfterReturning(value = "deleteServiceCall()", argNames = "rtv", returning = "rtv")
public void deleteServiceCallCalls(JoinPoint joinPoint, Object rtv)
        throws Throwable {
    // 获取方法名
    String methodName = joinPoint.getSignature().getName();
    StringBuffer rs = new StringBuffer();
    rs.append(methodName);
    String className = null;
    for (Object info : joinPoint.getArgs()) {
        // 获取对象类型
        className = info.getClass().getName();
        className = className.substring(className.lastIndexOf(".") + 1);
        rs.append("[参数1,类型:" + className + ",值:(id:"
                + joinPoint.getArgs()[0] + ")");
    }
    // 创建日志对象
    LogInfoEntity log = new LogInfoEntity();
    log.setUserId(ShiroAuthenticationManager.getUserId());// 用户编号
    log.setAccountName(ShiroAuthenticationManager.getUserAccountName());
    log.setCreateTime(new Date(System.currentTimeMillis()));// 操作时间
    log.setContent(rs.toString());// 操作内容
    log.setOperation("delete");// 操作

    logService.log(log);// 添加日志
}
项目:spring-cloud-samples    文件:DefaultFeignExceptionHandlerInterceptor.java   
/**
 * @param data
 * @throws ClassNotFoundException
 * @throws HttpMessageNotWritableException
 * @throws IOException
 */
@AfterReturning(pointcut = "point()", returning = "data")
public void after(JoinPoint jp, Object data) throws Exception {
    MethodInvocationProceedingJoinPoint joinPoint = (MethodInvocationProceedingJoinPoint) jp;
    Class<?> clazz = joinPoint.getSignature().getDeclaringType();
    if (AnnotationUtils.findAnnotation(clazz, FeignClient.class) == null) {
        log.debug("未找到feign 客户端");
        return;
    }
    CustomSecurityContext securityContext = SecurityContextHystrixRequestVariable.getInstance().get();
    ErrorResult errorResult = null;
    if (securityContext != null && (errorResult = securityContext.getErrorResult()) != null) {
        if (errorResult.getHttpStatus() != HttpStatus.OK.value()) {
            Class<?> exceptionClass = Class.forName(errorResult.getException());
            Constructor<?> constructor = exceptionClass.getConstructor(new Class[]{String.class, String.class});
            throw (CustomException) constructor
                    .newInstance(new Object[]{errorResult.getMessage(), errorResult.getCode()});
        }
    }
    SecurityContextHystrixRequestVariable.getInstance().remove();
}
项目:springbootWeb    文件:WebLogAspect.java   
@AfterReturning(returning = "ret", pointcut = "webLog()")
public void doAfterReturning(Object ret) {
    // 处理完请求,返回内容
    WebOosLog commLogger = commLoggerThreadLocal.get();
    commLogger.setActionResCode(ResponseStatus.SUCCESS);
    commLogger.setReqEndTime(new Date());
    commLogger.setReqDealTime((int) (commLogger.getReqEndTime().getTime() - commLogger.getReqStartTime().getTime()));
    commLogger.setResponseData(JSON.toJSONString(ret));
    commLogger.setIsUndefinedException(false);

    loggerRecordService.doRecord(commLogger);

    logger.debug("RESPONSE : " + JSON.toJSONString(ret));
    logger.debug("SPEND TIME : " + commLogger.getReqDealTime() + "ms");
    logger.debug("***************请求" + commLogger.getActionDesc() + "结束***************");
}
项目:PowerApi    文件:LogModifyAdvice.java   
/**
 * @param joinPoint
 */
@AfterReturning("logAnnoAspect()")

public void afterReturn(JoinPoint joinPoint) {
    MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
    Method method = methodSignature.getMethod();
    LogModify logModifyAnno = method.getAnnotation(LogModify.class);
    if (null != logModifyAnno) {

        BaseEntity entity = (BaseEntity) joinPoint.getArgs()[0];
        Log log = new Log();
        log.setUserId(((User) SecurityUtils.getSubject().getSession().getAttribute("curUser")).getId());
        log.setAction(ACTION + logModifyAnno.resource());
        log.setResource(entity.getLogResource());
        log.setResourceId(entity.getId());
        logService.insert(log);
    }
}
项目:PowerApi    文件:LogDeleteAdvice.java   
/**
 * @param joinPoint
 */
@AfterReturning("logAnnoAspect()")

public void afterReturn(JoinPoint joinPoint) {
    MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
    Method method = methodSignature.getMethod();
    LogDelete logDelete = method.getAnnotation(LogDelete.class);
    if (null != logDelete) {
        BaseEntity entity = (BaseEntity) joinPoint.getArgs()[0];
        Log log = new Log();
        log.setUserId(((User) SecurityUtils.getSubject().getSession().getAttribute("curUser")).getId());
        log.setAction(Constants.LOG_ACTION_DELETE + logDelete.resource());
        log.setResource(entity.getLogResource());
        log.setResourceId(entity.getId());
        logService.insert(log);
    }
}
项目:elucidate-server    文件:AnnotationListenerAspect.java   
@AfterReturning(pointcut = "execution(* com.digirati.elucidate.repository.AnnotationStoreRepository.createAnnotation(..))", returning = "w3cAnnotation")
public void afterCreate(W3CAnnotation w3cAnnotation) {

    for (RegisteredListener synchronousRegisteredListener : synchronousRegisteredListeners) {
        LOGGER.info(String.format("Notifying synchronous listener [%s] of CREATE on W3CAnnotation [%s]", synchronousRegisteredListener, w3cAnnotation));
        synchronousRegisteredListener.notifyCreate(w3cAnnotation);
        LOGGER.info(String.format("Synchronous listener [%s] has finished processing CREATE on W3CAnnotation [%s]", synchronousRegisteredListener, w3cAnnotation));
    }

    for (RegisteredListener asynchronousRegisteredListener : asynchronousRegisteredListeners) {
        taskExecutor.execute(() -> {
            LOGGER.info(String.format("Notifying asynchronous listener [%s] of CREATE on W3CAnnotation [%s]", asynchronousRegisteredListener, w3cAnnotation));
            asynchronousRegisteredListener.notifyCreate(w3cAnnotation);
            LOGGER.info(String.format("Asynchronous listener [%s] has finished processing CREATE on W3CAnnotation [%s]", asynchronousRegisteredListener, w3cAnnotation));
        });
    }

}
项目:elucidate-server    文件:AnnotationListenerAspect.java   
@AfterReturning(pointcut = "execution(* com.digirati.elucidate.repository.AnnotationStoreRepository.updateAnnotation(..))", returning = "w3cAnnotation")
public void afterUpdate(W3CAnnotation w3cAnnotation) {

    for (RegisteredListener synchronousRegisteredListener : synchronousRegisteredListeners) {
        LOGGER.info(String.format("Notifying synchronous listener [%s] of UPDATE on W3CAnnotation [%s]", synchronousRegisteredListener, w3cAnnotation));
        synchronousRegisteredListener.notifyUpdate(w3cAnnotation);
        LOGGER.info(String.format("Synchronous listener [%s] has finished processing UPDATE on W3CAnnotation [%s]", synchronousRegisteredListener, w3cAnnotation));
    }

    for (RegisteredListener asynchronousRegisteredListener : asynchronousRegisteredListeners) {
        taskExecutor.execute(() -> {
            LOGGER.info(String.format("Notifying asynchronous listener [%s] of UPDATE on W3CAnnotation [%s]", asynchronousRegisteredListener, w3cAnnotation));
            asynchronousRegisteredListener.notifyUpdate(w3cAnnotation);
            LOGGER.info(String.format("Asynchronous listener [%s] has finished processing UPDATE on W3CAnnotation [%s]", asynchronousRegisteredListener, w3cAnnotation));
        });
    }
}
项目:elucidate-server    文件:AnnotationListenerAspect.java   
@AfterReturning(pointcut = "execution(* com.digirati.elucidate.repository.AnnotationStoreRepository.deleteAnnotation(..))", returning = "w3cAnnotation")
public void afterDelete(W3CAnnotation w3cAnnotation) {

    for (RegisteredListener synchronousRegisteredListener : synchronousRegisteredListeners) {
        LOGGER.info(String.format("Notifying synchronous listener [%s] of DELETE on W3CAnnotation [%s]", synchronousRegisteredListener, w3cAnnotation));
        synchronousRegisteredListener.notifyDelete(w3cAnnotation);
        LOGGER.info(String.format("Synchronous listener [%s] has finished processing DELETE on W3CAnnotation [%s]", synchronousRegisteredListener, w3cAnnotation));
    }

    for (RegisteredListener asynchronousRegisteredListener : asynchronousRegisteredListeners) {
        taskExecutor.execute(() -> {
            LOGGER.info(String.format("Notifying asynchronous listener [%s] of DELETE on W3CAnnotation [%s]", asynchronousRegisteredListener, w3cAnnotation));
            asynchronousRegisteredListener.notifyDelete(w3cAnnotation);
            LOGGER.info(String.format("Asynchronous listener [%s] has finished processing DELETE on W3CAnnotation [%s]", asynchronousRegisteredListener, w3cAnnotation));
        });
    }
}
项目:DataHubSystem    文件:CacheAspectDefinition.java   
@AfterReturning ("@annotation(fr.gael.dhus.spring.cache.IncrementCache)")
public void updateCache (JoinPoint joinPoint)
{
   IncrementCache annotation = ((MethodSignature) joinPoint.getSignature ())
         .getMethod ().getAnnotation (IncrementCache.class);

   Cache cache = cacheManager.getCache (annotation.name ());
   if (cache != null)
   {
      synchronized (cache)
      {
         Integer old_value = cache.get (annotation.key (), Integer.class);
         cache.clear ();
         if (old_value == null)
         {
            return;
         }
         cache.put (annotation.key (), (old_value + annotation.value ()));
      }
   }

}
项目:poseidon    文件:ViewNameProcessAdvice.java   
@AfterReturning(pointcut = "execution(* com.poseidon.*.*Controller..*(..)))", returning = "result")
public void processViewName(JoinPoint joinPoint, Object result) {

    final MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
    Method method = methodSignature.getMethod();

    ViewName annotation = method.getAnnotation(ViewName.class);

    if(annotation == null){
        return;
    }

    String errorView = annotation.errorView();
    if(errorView!= null && !errorView.isEmpty()){
        buildModelAndView(result, errorView);
        return;
    }

    String name = annotation.name();
    Class<?> returnType = method.getReturnType();
    if(!returnType.isAssignableFrom(ModelAndView.class)){
        throw new ViewNameException("Para usar a annotation @ViewName é preciso que o metodo retorne ModelAndView.");
    }
    buildModelAndView(result, name);

}
项目:JForum    文件:CacheEvictionRules.java   
@AfterReturning("execution (* net.jforum.services.ModerationService.moveTopics(..)) && args(toForumId, log, topicIds)")
public void moveTopics(int toForumId, ModerationLog log, int... topicIds) {
    if (!ArrayUtils.isEmpty(topicIds)) {
        this.clearCacheRegion(this.factoryImplementor.getQueryCache("forumDAO.getTotalPosts#" + toForumId));
        this.clearCacheRegion(this.factoryImplementor.getQueryCache("forumDAO.getTotalTopics#" + toForumId));
        Cache cache = this.factoryImplementor.getSecondLevelCacheRegion("net.jforum.entities.Forum");

        if (cache != null) {
            cache.remove("net.jforum.entities.Forum#" + toForumId);
        }

        Topic topic = (Topic)this.sessionFactory.getCurrentSession().get(Topic.class, topicIds[0]);
        Forum forum = topic.getForum();

        this.clearCacheRegion(this.factoryImplementor.getQueryCache("forumDAO.getTotalPosts#" + forum.getId()));
        this.clearCacheRegion(this.factoryImplementor.getQueryCache("forumDAO.getTotalTopics#" + forum.getId()));

        Cache cache2 = this.factoryImplementor.getSecondLevelCacheRegion("net.jforum.entities.Forum");

        if (cache2 != null) {
            cache2.remove("net.jforum.entities.Forum#" + forum.getId());
        }
    }
}
项目:srccode    文件:LoggingAspect.java   
/**
 * Method responsible for catching controllers method.
 * @param joinPoint
 * @param result 
 */
@AfterReturning(pointcut = "execution(* pl.orange.labs.mundo.controller.*.*(..))", returning = "result")
public void logAfterReturning(JoinPoint joinPoint, Object result) {  

    //Creates new Log object.
    Log log = new Log();
    //sets name of requested controller method
    log.setMethod(joinPoint.getSignature().getName());
    long time = System.currentTimeMillis();
    //sets event time
    Timestamp timestamp = new java.sql.Timestamp(time);
    log.setStamp(timestamp);
    //sets user data
    log.setAccount(SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString());
    //Persists object
    logRepository.save(log);        
    if (LOGGER.isDebugEnabled()) LOGGER.debug("hijacked : " + joinPoint.getSignature().getName());
    if (LOGGER.isDebugEnabled()) LOGGER.debug(result);
}
项目:srccode    文件:LoggingAspect.java   
/**
 * Method responsible for catching controllers method in plugins.
 * @param joinPoint
 * @param result 
 */
@AfterReturning(pointcut = "execution(* pl.orange.labs.mundo.plugins.*.controller.*.*(..))", returning = "result")
public void logAfterPluginReturning(JoinPoint joinPoint, Object result) {  

    //creates new Log object
    Log log = new Log();
    //sets name of requested controller method
    log.setMethod(joinPoint.getSignature().getName());
    //gets current time
    long time = System.currentTimeMillis();
    //creates new Timestamp object
    Timestamp timestamp = new java.sql.Timestamp(time);        
    log.setStamp(timestamp);
    //sets user data
    log.setAccount(SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString());
    //persists object
    logRepository.save(log);        
    if (LOGGER.isDebugEnabled()) LOGGER.debug("hijacked : " + joinPoint.getSignature().getName());
    if (LOGGER.isDebugEnabled()) LOGGER.debug(result);
}
项目:simple-spring-memcached    文件:IncrementCounterInCacheAdvice.java   
@AfterReturning("incrementSingleCounter()")
public void incrementSingle(final JoinPoint jp) throws Throwable {
    if (isDisabled()) {
        getLogger().info("Cache disabled");
        return;
    }

    // This is injected caching. If anything goes wrong in the caching, LOG
    // the crap outta it, but do not let it surface up past the AOP injection itself.
    // It will be invoked only if underlying method completes successfully.
    String cacheKey = null;
    IncrementCounterInCache annotation;
    try {
        Method methodToCache = getCacheBase().getMethodToCache(jp);
        annotation = methodToCache.getAnnotation(IncrementCounterInCache.class);
        AnnotationData data = AnnotationDataBuilder.buildAnnotationData(annotation, IncrementCounterInCache.class, methodToCache);
        cacheKey = getCacheBase().getCacheKeyBuilder().getCacheKey(data, jp.getArgs(), methodToCache.toString());
        getCacheBase().getCache(data).incr(cacheKey, 1, 1);
    } catch (Exception ex) {
        warn(ex, "Incrementing counter [%s] via %s aborted due to an error.", cacheKey, jp.toShortString());
    }
}
项目:simple-spring-memcached    文件:DecrementCounterInCacheAdvice.java   
@AfterReturning("decrementSingleCounter()")
public void decrementSingle(final JoinPoint jp) throws Throwable {
    if (isDisabled()) {
        getLogger().info("Cache disabled");
        return;
    }
    // This is injected caching. If anything goes wrong in the caching, LOG
    // the crap outta it, but do not let it surface up past the AOP injection itself.
    // It will be invoked only if underlying method completes successfully.
    String cacheKey = null;
    DecrementCounterInCache annotation;
    try {
        Method methodToCache = getCacheBase().getMethodToCache(jp);
        annotation = methodToCache.getAnnotation(DecrementCounterInCache.class);
        AnnotationData data = AnnotationDataBuilder.buildAnnotationData(annotation, DecrementCounterInCache.class, methodToCache);
        cacheKey = getCacheBase().getCacheKeyBuilder().getCacheKey(data, jp.getArgs(), methodToCache.toString());
        getCacheBase().getCache(data).decr(cacheKey, 1);
    } catch (Exception ex) {
        warn(ex, "Decrementing counter [%s] via %s aborted due to an error.", cacheKey, jp.toShortString());
    }
}
项目:ix3    文件:AuthorizationInterceptorImplBusinessProcess.java   
/**
 * Se ejecuta DESPUES de cualquier llamada a una clase que herede del interfaz "BusinessProcess" y comprueba la seguridad de si se puede retornar los datos del método
 *
 * @param joinPoint
 * @param result
 * @throws BusinessException
 */
@AfterReturning(pointcut = "within(es.logongas.ix3.businessprocess.BusinessProcess+)", returning = "result")
public void checkPostAuthorized(JoinPoint joinPoint, Object result) throws Exception {
    Principal principal = getPrincipal(joinPoint);
    String secureResource = getSecureResource(joinPoint);
    PostArguments arguments = new PostArguments(getMethodArguments(joinPoint), result);

    boolean isAuthorized;
    try (DataSession dataSession = dataSessionFactory.getDataSession()) {
        isAuthorized = authorizationManager.authorized(principal, SECURE_RESOURCE_TYPE_NAME, secureResource, PERMISSION_NAME_POST_EXECUTE, arguments, dataSession);
    }
    if (isAuthorized == false) {
        throw new BusinessSecurityException("El usuario " + principal + " no tiene permiso para devolver los datos del proceso de negocio:" + secureResource);
    }

}
项目:wso2-axis2-transports    文件:LogAspect.java   
@AfterReturning(
    pointcut="call(javax.activation.DataSource org.apache.axis2.format.MessageFormatterEx.getDataSource(..))",
    returning="dataSource")
public void afterGetDataSource(DataSource dataSource) {
    try {
        OutputStream out = LogManager.INSTANCE.createLog("formatter");
        try {
            InputStream in = dataSource.getInputStream();
            try {
                IOUtils.copy(in, out);
            } finally {
                in.close();
            }
        } finally {
            out.close();
        }
    } catch (Throwable ex) {
        log.error("Unable to dump message", ex);
    }
}
项目:jcloudscale    文件:ObjectLifecycleEventAspect.java   
@AfterReturning(pointcut = "execution(public String at.ac.tuwien.infosys.jcloudscale.server.JCloudScaleServer.createNewCloudObject(..))", returning = "ret")
public void matchObjectCreated(JoinPoint jp, String ret) throws JCloudScaleException {

       try {
        ObjectCreatedEvent event = new ObjectCreatedEvent();
        initializeBaseEventProperties(event);
        UUID objectId = UUID.fromString(ret);
        event.setObjectId(objectId);
        JCloudScaleServer server = (JCloudScaleServer)jp.getThis();
        // XXX AbstractJCloudScaleServerRunner
        // UUID serverId = JCloudScaleServerRunner.getInstance().getId();
        UUID serverId = AbstractJCloudScaleServerRunner.getInstance().getId();
        event.setHostId(serverId);
        ClassLoader cl = server.getCloudObjectClassLoader(objectId);
        Class<?> theClazz = Class.forName((String)(jp.getArgs()[0]), true, cl);
        event.setObjectType(theClazz);
        getMqHelper().sendEvent(event);
        log.finer("Sent object created for object "+objectId.toString());
       } catch (Exception e) {
        e.printStackTrace();
        log.severe("Error while triggering ObjectCreatedEvent: "+e.getMessage());
    }

}
项目:openyu-mix    文件:WuxingAspect.java   
/**
 * 玩五行
 * 
 * WuxingService
 * 
 * PlayResult play(boolean sendable, Role role, int playValue)
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.wuxing.service.WuxingService.play(..))", returning = "result")
public void play(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        int playValue = (Integer) args[2];
        //
        PlayResult returnValue = (PlayResult) result;
        if (returnValue != null) {
            // 記錄玩的
            wuxingLogService.recordPlay(role, returnValue.getPlayType(), returnValue.getPlayTime(),
                    returnValue.getOutcome(), returnValue.getTotalTimes(), returnValue.getSpendGold(),
                    returnValue.getSpendItems(), returnValue.getSpendCoin());

            // 記錄開出的結果,有成名的
            wuxingLogService.recordFamous(role, returnValue.getPlayType(), returnValue.getPlayTime(),
                    returnValue.getOutcomes());
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during play()").toString(), e);
    }
}
项目:openyu-mix    文件:WuxingAspect.java   
/**
 * 單擊獎勵放入包包
 * 
 * WuxingService
 * 
 * PutResult putOne(boolean sendable, Role role, String itemId, int amount)
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.wuxing.service.WuxingService.putOne(..))", returning = "result")
public void putOne(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        String itemId = (String) args[2];
        int amount = (Integer) args[3];
        //
        PutResult returnValue = (PutResult) result;
        //
        if (returnValue != null) {
            wuxingLogService.recordPut(role, PutType.ONE, returnValue.getAwards());
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during putOne()").toString(), e);
    }
}
项目:openyu-mix    文件:WuxingAspect.java   
/**
 * 所有中獎區獎勵放入包包
 * 
 * WuxingService
 * 
 * PutResult putAll(boolean sendable, Role role)
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.wuxing.service.WuxingService.putAll(..))", returning = "result")
public void putAll(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        //
        PutResult returnValue = (PutResult) result;
        //
        if (returnValue != null) {
            wuxingLogService.recordPut(role, PutType.ALL, returnValue.getAwards());
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during putAll()").toString(), e);
    }
}
项目:openyu-mix    文件:TrainAspect.java   
/**
 * 鼓舞訓練
 * 
 * TrainService
 * 
 * InspireResult inspire(boolean sendable, Role role);
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.train.service.TrainService.inspire(..))", returning = "result")
public void resetCoin(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        //
        InspireResult returnValue = (InspireResult) result;
        //
        if (returnValue != null) {
            trainLogService.recordInspire(role, returnValue.getInspireTime(), returnValue.getSpendItems(),
                    returnValue.getSpendCoin());
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during inspire()").toString(), e);
    }
}
项目:openyu-mix    文件:ManorAspect.java   
/**
 * 開墾
 * 
 * ManorService
 * 
 * ReclaimResult reclaim(boolean sendable, Role role, int farmIndex, String
 * landUniqueId);
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.manor.service.ManorService.reclaim(..))", returning = "result")
public void reclaim(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        int farmIndex = (Integer) args[2];
        String landUniqueId = (String) args[3];
        //
        ReclaimResult returnValue = (ReclaimResult) result;
        //
        if (returnValue != null) {
            manorLogService.recordReclaim(role, returnValue.getFarmIndex(), returnValue.getLand(),
                    returnValue.getSpendGold());
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during reclaim()").toString(), e);
    }
}
项目:openyu-mix    文件:ManorAspect.java   
/**
 * 休耕
 * 
 * ManorService
 * 
 * DisuseResult disuse(boolean sendable, Role role, int farmIndex);
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.manor.service.ManorService.disuse(..))", returning = "result")
public void disuse(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        int farmIndex = (Integer) args[2];
        //
        DisuseResult returnValue = (DisuseResult) result;
        //
        if (returnValue != null) {
            manorLogService.recordDisuse(role, returnValue.getFarmIndex(), returnValue.getLand(),
                    returnValue.getSpendGold());
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during disuse()").toString(), e);
    }
}
项目:openyu-mix    文件:ManorAspect.java   
/**
 * 耕種
 * 
 * ManorService
 * 
 * CultureResult culture(boolean sendable, Role role, int cultureValue, int
 * farmIndex, int gridIndex, String seedUniqueId);
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.manor.service.ManorService.culture(..))", returning = "result")
public void culture(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        int cultureValue = (Integer) args[2];
        int farmIndex = (Integer) args[3];
        int gridIndex = (Integer) args[4];
        String seedUniqueId = (String) args[5];
        //
        CultureResult returnValue = (CultureResult) result;
        //
        if (returnValue != null) {
            manorLogService.recordCulture(role, returnValue.getCultureType(), farmIndex, gridIndex,
                    returnValue.getSeed(), returnValue.getSpendItems(), returnValue.getSpendCoin());
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during culture()").toString(), e);
    }
}
项目:openyu-mix    文件:ManorAspect.java   
/**
 * 耕種
 * 
 * ManorService
 * 
 * CultureResult culture(boolean sendable, Role role, int cultureValue, int
 * farmIndex, int gridIndex, String seedUniqueId);
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.manor.service.ManorService.cultureAll(..))", returning = "result")
public void cultureAll(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        int cultureValue = (Integer) args[2];
        //
        CultureAllResult returnValue = (CultureAllResult) result;
        //
        if (returnValue != null) {
            // TODO 有分不同耕種類型
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during cultureAll()").toString(), e);
    }
}
项目:openyu-mix    文件:ItemAspect.java   
/**
 * 道具增加
 * 
 * ItemService
 * 
 * List<IncreaseItemResult> increaseItem(boolean sendable, Role role, Item
 * item)
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.item.service.ItemService.increaseItem(..))", returning = "result")
public void increaseItem(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        Item item = (Item) args[2];
        //
        @SuppressWarnings("unchecked")
        List<IncreaseItemResult> returnValue = (List<IncreaseItemResult>) result;
        //
        if (returnValue.size() > 0) {
            itemLogService.recordIncreaseItem(role, ActionType.BAG, returnValue);
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during increaseItem()").toString(), e);
    }
}
项目:openyu-mix    文件:ItemAspect.java   
/**
 * 道具增加, with itemId
 * 
 * ItemService
 * 
 * List<IncreaseItemResult> increaseItemWithItemId(boolean sendable, Role
 * role, String itemId, int amount)
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.item.service.ItemService.increaseItemWithItemId(..))", returning = "result")
public void increaseItemWithItemId(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        String itemId = (String) args[2];
        int amount = (Integer) args[3];
        //
        @SuppressWarnings("unchecked")
        List<IncreaseItemResult> returnValue = (List<IncreaseItemResult>) result;
        //
        if (returnValue.size() > 0) {
            itemLogService.recordIncreaseItem(role, ActionType.BAG, returnValue);
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during increaseItemWithItemId()").toString(), e);
    }
}
项目:openyu-mix    文件:ItemAspect.java   
/**
 * 增加多個道具
 * 
 * ItemService
 * 
 * List<IncreaseItemResult> increaseItems(boolean sendable, Role role,
 * Map<String, Integer> items)
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.item.service.ItemService.increaseItems(..))", returning = "result")
public void increaseItems(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        @SuppressWarnings("unchecked")
        Map<String, Integer> items = (Map<String, Integer>) args[2];
        //
        @SuppressWarnings("unchecked")
        List<IncreaseItemResult> returnValue = (List<IncreaseItemResult>) result;
        //
        if (returnValue.size() > 0) {
            itemLogService.recordIncreaseItem(role, ActionType.BAG, returnValue);
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during increaseItems()").toString(), e);
    }
}
项目:openyu-mix    文件:ItemAspect.java   
/**
 * 道具減少
 * 
 * ItemService
 * 
 * List<DecreaseItemResult> decreaseItem(boolean sendable, Role role, Item
 * item)
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.item.service.ItemService.decreaseItem(..))", returning = "result")
public void decreaseItem(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        Item item = (Item) args[2];
        //
        @SuppressWarnings("unchecked")
        List<DecreaseItemResult> returnValue = (List<DecreaseItemResult>) result;
        //
        if (returnValue.size() > 0) {
            itemLogService.recordDecreaseItem(role, ActionType.BAG, returnValue);
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during decreaseItem()").toString(), e);
    }
}
项目:openyu-mix    文件:ItemAspect.java   
/**
 * 道具減少, with itemId
 * 
 * ItemService
 * 
 * List<DecreaseItemResult> decreaseItemWithItemId(boolean sendable, Role
 * role, String itemId, int amount)
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.item.service.ItemService.decreaseItemWithItemId(..))", returning = "result")
public void decreaseItemWithItemId(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        String itemId = (String) args[2];
        int amount = (Integer) args[3];
        //
        List<DecreaseItemResult> returnValue = (List<DecreaseItemResult>) result;
        //
        if (returnValue.size() > 0) {
            itemLogService.recordDecreaseItem(role, ActionType.BAG, returnValue);
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during decreaseItemWithItemId()").toString(), e);
    }
}
项目:openyu-mix    文件:ItemAspect.java   
/**
 * 道具減少, with uniqueId
 * 
 * ItemService
 * 
 * DecreaseItemResult decreaseItemWithUniqueId(boolean sendable, Role role,
 * String uniqueId, int amount)
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.item.service.ItemService.decreaseItemWithUniqueId(..))", returning = "result")
public void decreaseItemWithUniqueId(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        String uniqueId = (String) args[2];
        int amount = (Integer) args[3];
        //
        DecreaseItemResult returnValue = (DecreaseItemResult) result;
        //
        if (returnValue != null) {
            itemLogService.recordDecreaseItem(role, ActionType.BAG, returnValue);
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during decreaseItemWithUniqueId()").toString(), e);
    }
}
项目:openyu-mix    文件:SasangAspect.java   
/**
 * 玩四象
 * 
 * SasangService
 * 
 * PlayResult play(boolean sendable, Role role, int playValue)
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.sasang.service.SasangService.play(..))", returning = "result")
public void play(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        int playValue = (Integer) args[2];
        //
        PlayResult returnValue = (PlayResult) result;
        if (returnValue != null) {
            // 記錄玩的
            sasangLogService.recordPlay(role, returnValue.getPlayType(), returnValue.getPlayTime(),
                    returnValue.getOutcome(), returnValue.getTotalTimes(), returnValue.getSpendGold(),
                    returnValue.getSpendItems(), returnValue.getSpendCoin());

            // 記錄開出的結果,有成名的
            sasangLogService.recordFamous(role, returnValue.getPlayType(), returnValue.getPlayTime(),
                    returnValue.getOutcomes());
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during play()").toString(), e);
    }
}
项目:openyu-mix    文件:SasangAspect.java   
/**
 * 單擊獎勵放入包包
 * 
 * SasangService
 * 
 * PutResult putOne(boolean sendable, Role role, String itemId, int amount)
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.sasang.service.SasangService.putOne(..))", returning = "result")
public void putOne(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        String itemId = (String) args[2];
        int amount = (Integer) args[3];
        //
        PutResult returnValue = (PutResult) result;
        //
        if (returnValue != null) {
            sasangLogService.recordPut(role, PutType.ONE, returnValue.getAwards());
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during putOne()").toString(), e);
    }
}
项目:openyu-mix    文件:SasangAspect.java   
/**
 * 所有中獎區獎勵放入包包
 * 
 * SasangService
 * 
 * PutResult putAll(boolean sendable, Role role)
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.sasang.service.SasangService.putAll(..))", returning = "result")
public void putAll(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        Role role = (Role) args[1];
        //
        PutResult returnValue = (PutResult) result;
        //
        if (returnValue != null) {
            sasangLogService.recordPut(role, PutType.ALL, returnValue.getAwards());
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during putAll()").toString(), e);
    }
}
项目:openyu-mix    文件:AccountAspect.java   
/**
 * 增加帳戶的儲值幣
 * 
 * AccountService
 * 
 * int increaseCoin(boolean sendable, String accountId, Role role, int coin,
 * boolean accuable, CoinReason coinReason);
 */
@AfterReturning(pointcut = "execution(public * org.openyu.mix.account.service.AccountService.increaseCoin(..))", returning = "result")
public void increaseCoin(JoinPoint joinPoint, Object result) throws Throwable {
    try {
        String method = joinPoint.getSignature().getName();
        // 參數
        Object[] args = joinPoint.getArgs();
        boolean sendable = (Boolean) args[0];
        String accountId = (String) args[1];
        Role role = (Role) args[2];
        int coin = (Integer) args[3];
        boolean accuable = (Boolean) args[4];
        CoinType coinReason = (CoinType) args[5];
        //
        int returnValue = safeGet((Integer) result);
        if (returnValue != 0 && coinReason != null) {
            accountLogService.recordIncreaseCoin(accountId, role, returnValue, coinReason);
        }
    } catch (Throwable e) {
        LOGGER.error(new StringBuilder("Exception encountered during increaseCoin()").toString(), e);
    }
}