Loading pom.xml +19 −2 Original line number Diff line number Diff line Loading @@ -72,9 +72,26 @@ <dependency> <groupId>com.inteligr8.alfresco</groupId> <artifactId>aspectj-platform-module</artifactId> <version>1.0.0</version> <version>1.0.1</version> <type>amp</type> <scope>provided</scope> </dependency> <!-- AMP resources are included in the WAR, not the extension directory; this makes aspectjweaver available to javaagent --> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>${aspectj.version}</version> <scope>test</scope> </dependency> <!-- Removes startup warning regarding annotations that aren't annotations --> <dependency> <groupId>jakarta.transaction</groupId> <artifactId>jakarta.transaction-api</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> </dependency> </dependencies> Loading src/main/java/com/inteligr8/alfresco/annotations/TransactionalWrapper.java +12 −3 Original line number Diff line number Diff line Loading @@ -19,9 +19,18 @@ public class TransactionalWrapper { this.jtxl = txl; } public TransactionalWrapper(Method method) { this.stxl = method.getAnnotation(Transactional.class); this.jtxl = method.getAnnotation(javax.transaction.Transactional.class); public static TransactionalWrapper wrap(Method method) { Transactional stxl = method.getAnnotation(Transactional.class); javax.transaction.Transactional jtxl = method.getAnnotation(javax.transaction.Transactional.class); if (stxl == null && jtxl == null) { return null; } else if (stxl != null) { return new TransactionalWrapper(stxl); } else if (jtxl != null) { return new TransactionalWrapper(jtxl); } else { throw new IllegalStateException("This should never happen"); } } public boolean isReadOnly() { Loading src/main/java/com/inteligr8/alfresco/annotations/aspect/RetryingTransactionAspect.java +7 −3 Original line number Diff line number Diff line Loading @@ -46,20 +46,24 @@ public class RetryingTransactionAspect { @Autowired private TransactionService txService; @Pointcut("@annotation(org.springframework.transaction.annotation.Transactional || javax.transaction.Transactional) && execution(* *(..))") @Pointcut("@annotation(org.springframework.transaction.annotation.Transactional) && execution(* *(..))") public void isTransactionalAnnotated() { } @Pointcut("@annotation(javax.transaction.Transactional) && execution(* *(..))") public void isJtaTransactionalAnnotated() { } @Pointcut("@annotation(com.inteligr8.alfresco.annotations.TransactionalRetryable) && execution(* *(..))") public void isTransactionalRetryableAnnotated() { } @Around("isTransactionalAnnotated() || isTransactionalRetryableAnnotated()") @Around("isTransactionalAnnotated() || isJtaTransactionalAnnotated() || isTransactionalRetryableAnnotated()") public Object retryingTransactional(ProceedingJoinPoint joinPoint) throws Throwable { this.logger.trace("retryingTransactional({})", joinPoint); Method method = this.getMethod(joinPoint); TransactionalWrapper txl = new TransactionalWrapper(method); TransactionalWrapper txl = TransactionalWrapper.wrap(method); TransactionalRetryable txtry = method.getAnnotation(TransactionalRetryable.class); if (this.doCreateNewTxContext(txl) || this.isReadStateChange(txl)) { Loading Loading
pom.xml +19 −2 Original line number Diff line number Diff line Loading @@ -72,9 +72,26 @@ <dependency> <groupId>com.inteligr8.alfresco</groupId> <artifactId>aspectj-platform-module</artifactId> <version>1.0.0</version> <version>1.0.1</version> <type>amp</type> <scope>provided</scope> </dependency> <!-- AMP resources are included in the WAR, not the extension directory; this makes aspectjweaver available to javaagent --> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>${aspectj.version}</version> <scope>test</scope> </dependency> <!-- Removes startup warning regarding annotations that aren't annotations --> <dependency> <groupId>jakarta.transaction</groupId> <artifactId>jakarta.transaction-api</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> </dependency> </dependencies> Loading
src/main/java/com/inteligr8/alfresco/annotations/TransactionalWrapper.java +12 −3 Original line number Diff line number Diff line Loading @@ -19,9 +19,18 @@ public class TransactionalWrapper { this.jtxl = txl; } public TransactionalWrapper(Method method) { this.stxl = method.getAnnotation(Transactional.class); this.jtxl = method.getAnnotation(javax.transaction.Transactional.class); public static TransactionalWrapper wrap(Method method) { Transactional stxl = method.getAnnotation(Transactional.class); javax.transaction.Transactional jtxl = method.getAnnotation(javax.transaction.Transactional.class); if (stxl == null && jtxl == null) { return null; } else if (stxl != null) { return new TransactionalWrapper(stxl); } else if (jtxl != null) { return new TransactionalWrapper(jtxl); } else { throw new IllegalStateException("This should never happen"); } } public boolean isReadOnly() { Loading
src/main/java/com/inteligr8/alfresco/annotations/aspect/RetryingTransactionAspect.java +7 −3 Original line number Diff line number Diff line Loading @@ -46,20 +46,24 @@ public class RetryingTransactionAspect { @Autowired private TransactionService txService; @Pointcut("@annotation(org.springframework.transaction.annotation.Transactional || javax.transaction.Transactional) && execution(* *(..))") @Pointcut("@annotation(org.springframework.transaction.annotation.Transactional) && execution(* *(..))") public void isTransactionalAnnotated() { } @Pointcut("@annotation(javax.transaction.Transactional) && execution(* *(..))") public void isJtaTransactionalAnnotated() { } @Pointcut("@annotation(com.inteligr8.alfresco.annotations.TransactionalRetryable) && execution(* *(..))") public void isTransactionalRetryableAnnotated() { } @Around("isTransactionalAnnotated() || isTransactionalRetryableAnnotated()") @Around("isTransactionalAnnotated() || isJtaTransactionalAnnotated() || isTransactionalRetryableAnnotated()") public Object retryingTransactional(ProceedingJoinPoint joinPoint) throws Throwable { this.logger.trace("retryingTransactional({})", joinPoint); Method method = this.getMethod(joinPoint); TransactionalWrapper txl = new TransactionalWrapper(method); TransactionalWrapper txl = TransactionalWrapper.wrap(method); TransactionalRetryable txtry = method.getAnnotation(TransactionalRetryable.class); if (this.doCreateNewTxContext(txl) || this.isReadStateChange(txl)) { Loading