org.springframework.transaction.event.TransactionPhase Java Examples
The following examples show how to use
org.springframework.transaction.event.TransactionPhase.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestOrderChangedEventListener.java From cuba with Apache License 2.0 | 5 votes |
@TransactionalEventListener(phase = TransactionPhase.BEFORE_COMMIT) public void onOrderChanged(EntityChangedEvent<Order, UUID> event) { if (!enabled) return; switch (event.getType()) { case DELETED: return; case CREATED: case UPDATED: { Order order = tdm.load(event.getEntityId()) .view(View.LOCAL) .one(); order.setNumber(order.getNumber() + "changed"); tdm.save(order); } } }
Example #2
Source File: TestProductChangeListener.java From cuba with Apache License 2.0 | 5 votes |
@TransactionalEventListener(phase = TransactionPhase.BEFORE_COMMIT) void beforeCommit(EntityChangedEvent<EceTestProduct, UUID> event) { if (event.getType() == EntityChangedEvent.Type.DELETED) return; EceTestProduct product = tdm.load(event.getEntityId()).one(); if (product.getName() == null) { product.setName("default name"); } tdm.save(product); if (doLog) { EceTestLogEntry logEntry = dm.create(EceTestLogEntry.class); logEntry.setMessage("Saving product: " + product); dm.commit(logEntry); } EceTestStock stock; Optional<EceTestStock> optStock = tdm.load(EceTestStock.class) .query("select e from test_EceTestStock e where e.product = :product") .parameter("product", product) .optional(); if (!optStock.isPresent()) { stock = tdm.create(EceTestStock.class); stock.setProduct(product); } else { stock = optStock.get(); } stock.setQuantity(stock.getQuantity() + 1); tdm.save(stock); }
Example #3
Source File: OnsBatchDatabaseTransactionMessageInterceptor.java From onetwo with Apache License 2.0 | 5 votes |
@TransactionalEventListener(phase=TransactionPhase.BEFORE_COMMIT) public void beforeCommit(SendMessageEvent event) { if (event.isBatchMode()) { this.getSendMessageRepository().batchSave(event.getSendMessageContexts()); CURRENT_MESSAGES.remove(); } }
Example #4
Source File: TestEventCaptor.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT, fallbackExecution = true) public void onTransactionalEvent(TaskEvent event) { transactionImmutableTaskEvents.push(event); }
Example #5
Source File: UserRemovedListener.java From code-examples with MIT License | 4 votes |
@TransactionalEventListener(condition = "#event.name eq 'reflectoring'", phase = TransactionPhase.AFTER_COMPLETION) void handleAfterUserRemoved(UserRemovedEvent event) { System.out.println(String.format("User removed (@TransactionalEventListener): %s", event.getName())); }
Example #6
Source File: TestEventCaptor.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT, fallbackExecution = true) public void onTransactionalEvent(ExecutionEvent event) { transactionImmutableExecutionEvents.push(event); }
Example #7
Source File: TestEventCaptor.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT, fallbackExecution = true) public void onTransactionalEvent(DelegateTask event) { transactionTaskEvents.push(new TaskEvent(event)); }
Example #8
Source File: TestEventCaptor.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT, fallbackExecution = true) public void onTransactionalEvent(DelegateExecution event) { transactionExecutionEvents.push(new ExecutionEvent(event)); }
Example #9
Source File: TestEventCaptor.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT, fallbackExecution = true) public void onTransactionalEvent(HistoryEvent event) { transactionHistoryEvents.push(event); }
Example #10
Source File: AnnotationDrivenEventListener.java From tutorials with MIT License | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.BEFORE_COMMIT) public void handleCustom(final CustomSpringEvent event) { System.out.println("Handling event inside a transaction BEFORE COMMIT."); hitCustomEventHandler = true; }
Example #11
Source File: DocumentServiceImpl.java From webanno with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.BEFORE_COMMIT) public void onBeforeDocumentRemovedEvent(BeforeDocumentRemovedEvent aEvent) { projectService.recalculateProjectState(aEvent.getDocument().getProject()); }
Example #12
Source File: DocumentServiceImpl.java From webanno with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.BEFORE_COMMIT) public void onAfterDocumentCreatedEvent(AfterDocumentCreatedEvent aEvent) { projectService.recalculateProjectState(aEvent.getDocument().getProject()); }
Example #13
Source File: DocumentServiceImpl.java From webanno with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.BEFORE_COMMIT) public void onDocumentStateChangeEvent(DocumentStateChangedEvent aEvent) { projectService.recalculateProjectState(aEvent.getDocument().getProject()); }
Example #14
Source File: DatabaseTransactionMessageInterceptor.java From onetwo with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase=TransactionPhase.AFTER_ROLLBACK) void afterRollback(SendMessageEvent event);
Example #15
Source File: DatabaseTransactionMessageInterceptor.java From onetwo with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase=TransactionPhase.AFTER_COMMIT) void afterCommit(SendMessageEvent event);
Example #16
Source File: TestEventCaptor.java From camunda-bpm-spring-boot-starter with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT, fallbackExecution = true) public void onTransactionalEvent(TaskEvent event) { transactionImmutableTaskEvents.push(event); }
Example #17
Source File: TestEventCaptor.java From camunda-bpm-spring-boot-starter with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT, fallbackExecution = true) public void onTransactionalEvent(ExecutionEvent event) { transactionImmutableExecutionEvents.push(event); }
Example #18
Source File: TestEventCaptor.java From camunda-bpm-spring-boot-starter with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT, fallbackExecution = true) public void onTransactionalEvent(DelegateTask event) { transactionTaskEvents.push(new TaskEvent(event)); }
Example #19
Source File: TestEventCaptor.java From camunda-bpm-spring-boot-starter with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT, fallbackExecution = true) public void onTransactionalEvent(DelegateExecution event) { transactionExecutionEvents.push(new ExecutionEvent(event)); }
Example #20
Source File: TestEventCaptor.java From camunda-bpm-spring-boot-starter with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT, fallbackExecution = true) public void onTransactionalEvent(HistoryEvent event) { transactionHistoryEvents.push(event); }
Example #21
Source File: DataManagerTransactionalUsageTest.java From cuba with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) protected void notifyAboutChanges(EntityChangedEvent<OrderLine, UUID> event) { System.out.println("Changed OrderLine: " + event); }
Example #22
Source File: CompletionRegisteringBeanPostProcessorUnitTest.java From spring-domain-events with Apache License 2.0 | 4 votes |
@TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK) void onAfterRollback(Object object) {}
Example #23
Source File: CompletionRegisteringBeanPostProcessor.java From spring-domain-events with Apache License 2.0 | 3 votes |
/** * Returns whether the given method is one that requires publication completion. * * @param method must not be {@literal null}. * @return */ static boolean isCompletingMethod(Method method) { Assert.notNull(method, "Method must not be null!"); return COMPLETING_METHOD.computeIfAbsent(method, it -> { TransactionalEventListener annotation = AnnotatedElementUtils.getMergedAnnotation(method, TransactionalEventListener.class); return annotation == null ? false : annotation.phase().equals(TransactionPhase.AFTER_COMMIT); }); }