|
21 | 21 | import static org.codehaus.groovy.grails.compiler.injection.GrailsASTUtils.buildGetPropertyExpression; |
22 | 22 | import static org.codehaus.groovy.grails.compiler.injection.GrailsASTUtils.buildSetPropertyExpression; |
23 | 23 | import grails.artefact.Artefact; |
24 | | -import grails.transaction.Transactional; |
25 | 24 | import grails.util.BuildSettings; |
26 | 25 | import grails.util.CollectionUtils; |
27 | 26 | import grails.validation.ASTValidateableHelper; |
@@ -403,16 +402,14 @@ protected void populateMethodWithCommandObjectInitializationCode(final ClassNode |
403 | 402 |
|
404 | 403 | protected MethodNode getMethodToIncludeCommandObjectInitializationCode(final MethodNode methodNode) { |
405 | 404 | MethodNode node = methodNode; |
406 | | - if(GrailsASTUtils.hasAnnotation(methodNode, Transactional.class)) { |
407 | | - final ClassNode declaringClass = methodNode.getDeclaringClass(); |
408 | | - final String txHandlingMethodName = TransactionalTransform.getTransactionHandlingMethodName(methodNode); |
409 | | - final Parameter[] originalMethodParameters = methodNode.getParameters(); |
410 | | - final Parameter[] txHandlingMethodParams = new Parameter[originalMethodParameters.length + 1]; |
411 | | - System.arraycopy(originalMethodParameters, 0, txHandlingMethodParams, 0, originalMethodParameters.length); |
412 | | - txHandlingMethodParams[txHandlingMethodParams.length-1] = new Parameter(ClassHelper.make(TransactionStatus.class), "transactionStatus"); |
413 | | - if(declaringClass.hasMethod(txHandlingMethodName, txHandlingMethodParams)) { |
414 | | - node = declaringClass.getMethod(txHandlingMethodName, txHandlingMethodParams); |
415 | | - } |
| 405 | + final ClassNode declaringClass = methodNode.getDeclaringClass(); |
| 406 | + final String txHandlingMethodName = TransactionalTransform.getTransactionHandlingMethodName(methodNode); |
| 407 | + final Parameter[] originalMethodParameters = methodNode.getParameters(); |
| 408 | + final Parameter[] txHandlingMethodParams = new Parameter[originalMethodParameters.length + 1]; |
| 409 | + System.arraycopy(originalMethodParameters, 0, txHandlingMethodParams, 0, originalMethodParameters.length); |
| 410 | + txHandlingMethodParams[txHandlingMethodParams.length - 1] = new Parameter(ClassHelper.make(TransactionStatus.class), "transactionStatus"); |
| 411 | + if (declaringClass.hasMethod(txHandlingMethodName, txHandlingMethodParams)) { |
| 412 | + node = declaringClass.getMethod(txHandlingMethodName, txHandlingMethodParams); |
416 | 413 | } |
417 | 414 | return node; |
418 | 415 | } |
|
0 commit comments