Search in sources :

Example 6 with After

use of org.aspectj.lang.annotation.After in project PhotoNoter by yydcdut.

the class PermissionAspect method afterPermissionRequestBack.

@After("execution(* android.support.v4.app.FragmentActivity.onRequestPermissionsResult(..))")
public void afterPermissionRequestBack(JoinPoint joinPoint) {
    YLog.i(TAG, "afterPermissionRequestBack");
    Object[] objects = joinPoint.getArgs();
    Object object = joinPoint.getTarget();
    if (objects.length >= 1 && objects[0] instanceof Integer && object != null && object instanceof IView && ((IView) object).getPresenter() != null) {
        int requestCode = (int) objects[0];
        invokeMethod(((IView) object).getPresenter(), requestCode);
    } else {
        YLog.i(TAG, "afterPermissionRequestBack --> bad");
    }
}
Also used : IView(com.yydcdut.note.views.IView) JoinPoint(org.aspectj.lang.JoinPoint) ProceedingJoinPoint(org.aspectj.lang.ProceedingJoinPoint) After(org.aspectj.lang.annotation.After)

Example 7 with After

use of org.aspectj.lang.annotation.After in project trainning by fernandotomasio.

the class IndicacoesLoggerAdvice method logCreateIndicacao.

@After("create()")
public void logCreateIndicacao(JoinPoint joinPoint) {
    CursoDAO cursoDAO = factory.getCursoDAO();
    IndicacaoDTO indicacao = (IndicacaoDTO) joinPoint.getArgs()[0];
    if (indicacao != null) {
        try {
            LogDTO log = new LogDTO();
            log.setDataCriacao(new Date());
            log.setUser(getUser());
            String texto = "CRIAÇÃO DE INDICAÇÃO " + getDetails(indicacao);
            log.setTexto(texto);
            logger.create(log);
        } catch (DAOException ex) {
            Logger.getLogger(IndicacoesLoggerAdvice.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) LogDTO(com.tomasio.projects.trainning.dto.LogDTO) CursoDAO(com.tomasio.projects.trainning.dao.CursoDAO) Date(java.util.Date) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) After(org.aspectj.lang.annotation.After)

Example 8 with After

use of org.aspectj.lang.annotation.After in project ovirt-engine by oVirt.

the class DontPrune method afterCreateLivenessAnalyzer.

/**
 * Right after constructing the liveness analyzer, make sure that all types
 * matched by the regular expression are marked as if they were referenced
 * by the GWT application code.
 */
@After("createLivenessAnalyzer(analyzer, program)")
public void afterCreateLivenessAnalyzer(ControlFlowAnalyzer analyzer, JProgram program) {
    // Get the regular expression and warn the user if it's empty:
    String dontPruneRe = System.getProperty(GWT_DONTPRUNE);
    if (dontPruneRe == null) {
        String error = "The system property '" + GWT_DONTPRUNE + "' that specifies the types not to be pruned wasn't set!";
        System.err.println(error);
        throw new RuntimeException(error);
    }
    // Compile the regular expression:
    Pattern dontPrunePattern = Pattern.compile(dontPruneRe);
    // Scan all the types and make sure that the ones matching the given regular
    // expression are not pruned:
    program.getDeclaredTypes().stream().filter(type -> dontPrunePattern.matcher(type.getName()).matches()).forEach(type -> {
        // Note: calling "analyzer.traverseFromInstantiationOf(type)"
        // may cause GWT compiler to crash on NPE; don't use that method:
        analyzer.traverseFromReferenceTo(type);
        // Make sure that all methods of the given type are not pruned:
        for (JMethod method : type.getMethods()) {
            analyzer.traverseFrom(method);
        }
    });
}
Also used : ControlFlowAnalyzer(com.google.gwt.dev.jjs.impl.ControlFlowAnalyzer) Aspect(org.aspectj.lang.annotation.Aspect) JProgram(com.google.gwt.dev.jjs.ast.JProgram) After(org.aspectj.lang.annotation.After) Pattern(java.util.regex.Pattern) Pointcut(org.aspectj.lang.annotation.Pointcut) JMethod(com.google.gwt.dev.jjs.ast.JMethod) Pattern(java.util.regex.Pattern) JMethod(com.google.gwt.dev.jjs.ast.JMethod) After(org.aspectj.lang.annotation.After)

Example 9 with After

use of org.aspectj.lang.annotation.After in project apollo by ctripcorp.

the class NamespaceUnlockAspect method requireLockAdvice.

// delete item
@After("@annotation(PreAcquireNamespaceLock) && args(itemId, operator, ..)")
public void requireLockAdvice(long itemId, String operator) {
    Item item = itemService.findOne(itemId);
    if (item == null) {
        throw new BadRequestException("item not exist.");
    }
    tryUnlock(namespaceService.findOne(item.getNamespaceId()));
}
Also used : Item(com.ctrip.framework.apollo.biz.entity.Item) BadRequestException(com.ctrip.framework.apollo.common.exception.BadRequestException) After(org.aspectj.lang.annotation.After)

Example 10 with After

use of org.aspectj.lang.annotation.After in project PhotoNoter by yydcdut.

the class PermissionAspect method afterPermissionRequestBack4Fragment.

@After("execution(* android.app.Fragment.onRequestPermissionsResult(..))")
public void afterPermissionRequestBack4Fragment(JoinPoint joinPoint) {
    Object[] objects = joinPoint.getArgs();
    Object object = joinPoint.getTarget();
    if (objects.length >= 1 && objects[0] instanceof Integer && object != null && object instanceof IView && ((IView) object).getPresenter() != null) {
        int requestCode = (int) objects[0];
        invokeMethod(((IView) object).getPresenter(), requestCode);
    } else {
        YLog.i(TAG, "afterPermissionRequestBack4Fragment --> bad");
    }
}
Also used : IView(com.yydcdut.note.views.IView) JoinPoint(org.aspectj.lang.JoinPoint) ProceedingJoinPoint(org.aspectj.lang.ProceedingJoinPoint) After(org.aspectj.lang.annotation.After)

Aggregations

After (org.aspectj.lang.annotation.After)12 LogDTO (com.tomasio.projects.trainning.dto.LogDTO)3 DAOException (com.tomasio.projects.trainning.exception.DAOException)3 Date (java.util.Date)3 CursoDAO (com.tomasio.projects.trainning.dao.CursoDAO)2 IView (com.yydcdut.note.views.IView)2 JoinPoint (org.aspectj.lang.JoinPoint)2 ProceedingJoinPoint (org.aspectj.lang.ProceedingJoinPoint)2 IPage (com.agiletec.aps.system.services.page.IPage)1 Widget (com.agiletec.aps.system.services.page.Widget)1 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)1 Item (com.ctrip.framework.apollo.biz.entity.Item)1 BadRequestException (com.ctrip.framework.apollo.common.exception.BadRequestException)1 JMethod (com.google.gwt.dev.jjs.ast.JMethod)1 JProgram (com.google.gwt.dev.jjs.ast.JProgram)1 ControlFlowAnalyzer (com.google.gwt.dev.jjs.impl.ControlFlowAnalyzer)1 CursoDTO (com.tomasio.projects.trainning.dto.CursoDTO)1 IndicacaoDTO (com.tomasio.projects.trainning.dto.IndicacaoDTO)1 MatriculaDTO (com.tomasio.projects.trainning.dto.MatriculaDTO)1 Pattern (java.util.regex.Pattern)1