org.springframework.data.rest.core.annotation.HandleBeforeCreate Java Examples
The following examples show how to use
org.springframework.data.rest.core.annotation.HandleBeforeCreate.
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: InventoryTransferEventHandler.java From moserp with Apache License 2.0 | 6 votes |
@HandleBeforeCreate public void processInventoryTransfer(InventoryTransfer inventoryTransfer) { InventoryItem sourceInventory = inventoryRepository.findByProductAndFacility(inventoryTransfer.getProductInstance(), inventoryTransfer.getFromFacility()); if (sourceInventory == null) { sourceInventory = new InventoryItem(inventoryTransfer.getProductInstance(), inventoryTransfer.getFromFacility()); } InventoryItem targetInventory = inventoryRepository.findByProductAndFacility(inventoryTransfer.getProductInstance(), inventoryTransfer.getToFacility()); if (targetInventory == null) { targetInventory = new InventoryItem(inventoryTransfer.getProductInstance(), inventoryTransfer.getToFacility()); } sourceInventory.bookOutgoing(inventoryTransfer); targetInventory.bookIncoming(inventoryTransfer); inventoryRepository.save(sourceInventory); inventoryRepository.save(targetInventory); }
Example #2
Source File: CommandsHandler.java From factory with MIT License | 5 votes |
@HandleBeforeCreate @HandleBeforeSave public void adjust(DemandAdjustmentEntity adjustment) { LocalDate latest = adjustment.getAdjustment() .latestAdjustment() .orElse(LocalDate.now(clock)); adjustment.setCleanAfter(latest.plusDays(7)); service.adjust(adjustment.getAdjustment()); }
Example #3
Source File: BookmarkEventHandler.java From scraping-microservice-java-python-rabbitmq with Apache License 2.0 | 5 votes |
@HandleBeforeCreate public void handleBookmarkCreate(Bookmark bookmark) { bookmark.setCreated(new Date()); bookmark.setUrl(bookmark.getUrl().trim()); }
Example #4
Source File: OutgoingDeliveryEventHandler.java From moserp with Apache License 2.0 | 4 votes |
@HandleBeforeCreate public void processOutgoingDelivery(OutgoingDelivery OutgoingDelivery) { OutgoingDelivery.getItems().forEach(item -> bookItem(OutgoingDelivery.getFromFacility(), item)); }
Example #5
Source File: IncomingDeliveryEventHandler.java From moserp with Apache License 2.0 | 4 votes |
@HandleBeforeCreate public void processIncomingDelivery(IncomingDelivery incomingDelivery) { incomingDelivery.getItems().forEach(item -> bookItem(incomingDelivery.getToFacility(), item)); }
Example #6
Source File: BookEventHandler.java From tutorials with MIT License | 4 votes |
@HandleBeforeCreate public void handleBookBeforeCreate(Book book) { logger.info("Inside Book Before Create ...."); book.getAuthors(); }
Example #7
Source File: BookEventHandler.java From tutorials with MIT License | 4 votes |
@HandleBeforeCreate public void handleAuthorBeforeCreate(Author author) { logger.info("Inside Author Before Create ...."); author.getBooks(); }