Example usage for org.aspectj.lang ProceedingJoinPoint proceed

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

Introduction

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

Prototype

public Object proceed() throws Throwable;

Source Link

Document

Proceed with the next advice or target method invocation

Usage

From source file:com.qcadoo.mes.techSubcontrForDeliveries.aop.DeliveredProductDetailsHooksTSFDOverrideAspect.java

License:Open Source License

@Around("getOrderedProductQuantityExecution(deliveredProduct)")
public BigDecimal aroundGetOrderedProductQuantityExecution(final ProceedingJoinPoint pjp,
        final Entity deliveredProduct) throws Throwable {
    if (deliveredProductDetailsHooksTSFDOverrideUtil.shouldOverride(deliveredProduct)) {
        return deliveredProductDetailsHooksTSFDOverrideUtil
                .getOrderedProductQuantityWithOperation(deliveredProduct);
    } else {//from w ww . ja va 2 s  .c o  m
        return (BigDecimal) pjp.proceed();
    }
}

From source file:com.qcadoo.mes.techSubcontrForDeliveries.aop.DeliveredProductHooksTSFDOverrideAspect.java

License:Open Source License

@Around("checkIfDeliveredProductAlreadyExistsExecution(deliveredProductDD, deliveredProduct)")
public boolean aroundCheckIfDeliveredProductAlreadyExistsExecution(final ProceedingJoinPoint pjp,
        final DataDefinition deliveredProductDD, final Entity deliveredProduct) throws Throwable {
    if (deliveredProductHooksTSFDOverrideUtil.shouldOverride()) {
        return deliveredProductHooksTSFDOverrideUtil.checkIfDeliveredProductAlreadyExists(deliveredProductDD,
                deliveredProduct);/* w w  w .  j av a  2  s  .c  om*/
    } else {
        return (Boolean) pjp.proceed();
    }
}

From source file:com.qcadoo.mes.techSubcontrForDeliveries.aop.DeliveryColumnFetcherTSFDOverrideAspect.java

License:Open Source License

@Around("compareProductsExecution(deliveryProduct, deliveredProduct)")
public boolean aroundCompareProductsExecution(final ProceedingJoinPoint pjp,
        final DeliveryProduct deliveryProduct, final Entity deliveredProduct) throws Throwable {
    if (deliveryColumnFetcherTSFDOverrideUtil.shouldOverride()) {
        return deliveryColumnFetcherTSFDOverrideUtil.compareProductsAndOperation(deliveryProduct,
                deliveredProduct);/*from w  w w  .  jav a 2  s.  c om*/
    } else {
        return (Boolean) pjp.proceed();
    }
}

From source file:com.qcadoo.mes.techSubcontrForDeliveries.aop.OrderedProductHooksTSFDOverrideAspect.java

License:Open Source License

@Around("checkIfOrderedProductAlreadyExistsExecution(orderedProductDD, orderedProduct)")
public boolean aroundCheckIfOrderedProductAlreadyExistsExecution(final ProceedingJoinPoint pjp,
        final DataDefinition orderedProductDD, final Entity orderedProduct) throws Throwable {
    if (orderedProductHooksTSFDOverrideUtil.shouldOverride()) {
        return orderedProductHooksTSFDOverrideUtil.checkIfOrderedProductAlreadyExists(orderedProductDD,
                orderedProduct);//from w  w w .  j  ava 2 s. co  m
    } else {
        return (Boolean) pjp.proceed();
    }
}

From source file:com.qcadoo.model.internal.aop.MonitorableAdvice.java

License:Open Source License

public Object doBasicProfiling(final ProceedingJoinPoint pjp, final Monitorable monitorable) throws Throwable {
    long start = System.currentTimeMillis();

    try {//from   w  ww.  j a  v  a  2  s .co  m
        return pjp.proceed();
    } finally {
        long end = System.currentTimeMillis();
        long difference = end - start;

        if (difference > monitorable.threshold() && PERFORMANCE_LOG.isWarnEnabled()) {
            PERFORMANCE_LOG.warn("Call " + pjp.getSignature().toShortString() + " took " + difference + " ms ");
        } else if (PERFORMANCE_LOG.isDebugEnabled()) {
            PERFORMANCE_LOG
                    .debug("Call " + pjp.getSignature().toShortString() + " took " + difference + " ms ");
        }
    }
}

From source file:com.qcadoo.plugin.internal.aop.RunIfEnabledAspect.java

License:Open Source License

private Object runIfEnabled(final ProceedingJoinPoint pjp, final ProceedingJoinPoint innerPjp,
        final RunIfEnabled annotation) throws Throwable {
    Object result = null;//ww w . j av  a2s. c om
    if (pluginsAreEnabled(annotation.value())) {
        result = pjp.proceed();
    } else if (innerPjp != null) {
        result = innerPjp.proceed();
    }
    return result;
}

From source file:com.qmetry.qaf.automation.step.JavaStepReporter.java

License:Open Source License

@Around("execution(@QAFTestStep * *.*(..))")
public Object javaTestStep(ProceedingJoinPoint jp, JoinPoint.StaticPart thisJoinPointStaticPart)
        throws Throwable {
    JavaStep testStep = null;/*w  ww  . j a  v a2 s .c  o m*/
    Signature sig = null;

    try {
        sig = thisJoinPointStaticPart.getSignature();
        if ((sig instanceof MethodSignature)
                && TestBaseProvider.instance().get().getContext().getBoolean(JavaStep.ATTACH_LISTENER, true)) {
            // this must be a call or execution join point
            Method method = ((MethodSignature) sig).getMethod();

            testStep = new MockJavaStep(method, jp);
            if (null != jp.getArgs()) {
                testStep.setActualArgs(jp.getArgs());
            }
        }
    } catch (Exception e) {
        // ignore it...
    }

    if (ConfigurationManager.getBundle().getBoolean("method.recording.mode", false)) {
        ConfigurationManager.getBundle().setProperty("method.param.names",
                ((MethodSignature) sig).getParameterNames());
        return null;
    } else {
        // unblock for sub-steps
        TestBaseProvider.instance().get().getContext().setProperty(JavaStep.ATTACH_LISTENER, true);
        if (null != testStep) {
            try {
                return testStep.execute();
            } catch (JPThrowable e) {
                throw e.getCause();
            }
        } else {

            // this call is from text client (bdd/kwd/excel)
            testStep = (JavaStep) TestBaseProvider.instance().get().getContext()
                    .getProperty("current.teststep");
            testStep.setFileName(jp.getSourceLocation().getFileName());
            testStep.setLineNumber(jp.getSourceLocation().getLine());
            testStep.signature = jp.getSignature().toLongString();

            return jp.proceed();

        }

    }

}

From source file:com.qpark.eip.core.spring.statistics.FlowExecutionLog.java

License:Open Source License

/**
 * Aspect around the execution of the invokeFlow method of all
 * {@link com.qpark.eip.inf.Flow} implementations.
 *
 * @param joinPoint//from   w  w w.ja va 2 s  . co  m
 *            The {@link ProceedingJoinPoint}.
 * @return the result of the flow.
 * @throws Throwable
 */
@Around(value = "execution(* com.qpark.eip.inf.Flow+.invokeFlow(..)) || execution(public * com.qpark.eip.inf.FlowGateway+.*(..))")
public Object invokeFlowAspect(final ProceedingJoinPoint joinPoint) throws Throwable {
    long start = System.currentTimeMillis();
    String interfaceName = this.getInterfaceName(joinPoint);
    String methodName = this.getMethodName(joinPoint);
    String userName = "";
    if (joinPoint.getArgs().length > 0 && joinPoint.getArgs()[0] != null) {
        userName = this.messageContentProvider.getUserName(joinPoint.getArgs()[0]);
    }
    this.logger.debug("+{}.{}({})", interfaceName, methodName, userName);
    Object result = null;
    try {
        result = joinPoint.proceed();
    } catch (Throwable t) {
        this.logger.debug(" {}.{}({}) failed with {}: {}", interfaceName, methodName, userName,
                t.getClass().getSimpleName(), t.getMessage());
        throw t;
    } finally {
        this.logger.debug("-{}.{}({}) {}", interfaceName, methodName, userName,
                DateUtil.getDuration(start, System.currentTimeMillis()));
    }
    return result;
}

From source file:com.qrmedia.commons.aspect.advice.BasicProfilingAdvice.java

License:Open Source License

@Around("com.qrmedia.commons.aspect.pointcut.Pointcuts.profiledOperation()")
public Object profileMethodExecution(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {

    // if the result will not be output anyway, don't bother profiling 
    if (!log.isDebugEnabled()) {
        return proceedingJoinPoint.proceed();
    }//  ww w . j a  v a 2s . c o  m

    long startTime = System.currentTimeMillis();
    Object advisedMethodResult = proceedingJoinPoint.proceed();
    logMethodExecutionProfile(proceedingJoinPoint, System.currentTimeMillis() - startTime);

    return advisedMethodResult;
}

From source file:com.qrmedia.commons.aspect.advice.MethodExecutionTracingAdvice.java

License:Open Source License

@Around("com.qrmedia.commons.aspect.pointcut.Pointcuts.tracedOperation()")
public Object traceMethodExecution(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {

    // if the result will not be output anyway, don't bother profiling 
    if (!log.isTraceEnabled()) {
        return proceedingJoinPoint.proceed();
    }//ww  w.  j  av a 2 s  .  com

    logMethodEntry(proceedingJoinPoint);
    Object advisedMethodResult = proceedingJoinPoint.proceed();
    logMethodExit(proceedingJoinPoint, advisedMethodResult);

    return advisedMethodResult;
}