Search in sources :

Example 1 with ResultUrlGenerator

use of org.talend.dataprep.async.result.ResultUrlGenerator in project data-prep by Talend.

the class AsyncAspect method getResultUrl.

/**
 * Return the URL used to get the result of the asynchronous method
 * @param pjp pjp the proceeding join point.
 * @return the URL used to get the result of the asynchronous method
 */
private AsyncExecutionResult getResultUrl(ProceedingJoinPoint pjp) {
    MethodSignature ms = (MethodSignature) pjp.getSignature();
    Method m = ms.getMethod();
    final AsyncOperation asyncOperationAnnotation = m.getAnnotation(AsyncOperation.class);
    Class<? extends ResultUrlGenerator> resultUrlClass = asyncOperationAnnotation.resultUrlGenerator();
    final ResultUrlGenerator resultUrlGenerator = applicationContext.getBean(resultUrlClass);
    Object[] args = AnnotationUtils.extractAsyncParameter(pjp);
    return resultUrlGenerator.generateResultUrl(args);
}
Also used : MethodSignature(org.aspectj.lang.reflect.MethodSignature) ResultUrlGenerator(org.talend.dataprep.async.result.ResultUrlGenerator) Method(java.lang.reflect.Method)

Aggregations

Method (java.lang.reflect.Method)1 MethodSignature (org.aspectj.lang.reflect.MethodSignature)1 ResultUrlGenerator (org.talend.dataprep.async.result.ResultUrlGenerator)1