Example usage for org.aspectj.lang ProceedingJoinPoint getThis

List of usage examples for org.aspectj.lang ProceedingJoinPoint getThis

Introduction

In this page you can find the example usage for org.aspectj.lang ProceedingJoinPoint getThis.

Prototype

Object getThis();

Source Link

Document

Returns the currently executing object.

Usage

From source file:org.phaidra.apihooks.APIHooksAspect.java

@Around("modifyObjectHook(context, pid, state, label, ownerId, logMessage, lastModifiedDate)")
public Object modifyObjectHook(Context context, String pid, String state, String label, String ownerId,
        String logMessage, Date lastModifiedDate, ProceedingJoinPoint thisJoinPoint) throws Throwable {

    logCall(pid);//from   ww w.ja v a2s  . c om

    String hv = m_hooks.runHook("modifyObject", (DOWriter) thisJoinPoint.getThis(), context, pid,
            new Object[] { state, label, ownerId });
    if (!hv.startsWith("OK"))
        throw new APIHooksException(hv);

    return thisJoinPoint.proceed();
}

From source file:uk.gov.ofwat.fountain.aspect.cache.dao.generic.FindByCodeAspect.java

License:Open Source License

@Around("uk.gov.ofwat.fountain.aspect.cache.dao.DaoCache.deleteCodedPC()")
public void removeFromCacheOnDelete(ProceedingJoinPoint pjp) throws Throwable {

    if (!isEnabled()) {
        pjp.proceed();//from  www  .j av  a2s .c  o m
        return;
    }
    Object[] args = pjp.getArgs();
    if (null != cacheByCode) {
        Integer key = (Integer) args[0];
        Coded coded = (Coded) ((EntityDao) pjp.getThis()).findById(key);
        String code = coded.getCode();
        pjp.proceed(args);
        cacheByCode.remove(code);
    } else {
        pjp.proceed(args);
    }
}

From source file:uk.gov.ofwat.fountain.aspect.cache.dao.generic.GetAllAspect.java

License:Open Source License

@Around("uk.gov.ofwat.fountain.aspect.cache.dao.DaoCache.deleteDaoPC()")
public void removeFromCacheOnDelete(ProceedingJoinPoint pjp) throws Throwable {

    if (!isEnabled()) {
        pjp.proceed();//  w ww.  ja  va  2 s . co m
        return;
    }
    Object[] args = pjp.getArgs();
    if (null != cacheAll) {
        Integer key = (Integer) args[0];
        Object domainObj = ((EntityDao) pjp.getThis()).findById(key);
        pjp.proceed(args);
        cacheAll.remove(domainObj);
    } else {
        pjp.proceed(args);
    }
}

From source file:uk.gov.ofwat.fountain.aspect.cache.dao.specific.modelDao.GetModelByNameAspect.java

License:Open Source License

@Around("execution(void uk.gov.ofwat.fountain.dao.ModelDao+.delete(int))")
public void removeFromCacheOnDelete(ProceedingJoinPoint pjp) throws Throwable {

    Object[] args = pjp.getArgs();
    pjp.proceed(args);/*from ww w . j  av  a2s.  c  om*/
    if (!isEnabled()) {
        return;
    }
    if (null == cacheModelByName) {
        return;
    }

    Integer key = (Integer) args[0];
    Model model = (Model) ((EntityDao) pjp.getThis()).findById(key);
    String name = model.getName();
    cacheModelByName.remove(name);
}