Guest User

Untitled

a guest
Mar 19th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. private void handleDateChange(List<Long> dpIdList) {
  2. for(Long dpid : dpIdList) {
  3. updateFeeTransactionsForDateChange(dpid);
  4. deactivateFeeTransactionsAfterUpdate(dpid);
  5. }
  6. }
  7.  
  8. public void updateFeeTransactionsForDateChange(final Long dealProductId) {
  9. List<FeeTransaction> feeTransactionList = feeTransactionDAO.getActiveUnmappedFeeTransactionEntitiesForDealProduct(dealProductId);
  10. for (FeeTransaction feeTransaction : feeTransactionList) {
  11. //Some Logic
  12. }
  13. }
  14.  
  15. public void deactivateFeeTransactionsAfterUpdate(final Long dealProductId) {
  16. String UPDATE_ACTIVE_FOR_ALLOCATIONS = "update fee_transaction ft set ft.active = 'N' where ft.deal_product_id = ?1 and ft.active = 'Y'";
  17. entityManager.createNativeQuery(UPDATE_ACTIVE_FOR_ALLOCATIONS).setParameter(1, dealProduct.getDealProductId()).executeUpdate();
  18. }
  19.  
  20. @Entity
  21. @Table(name = "FEE_TRANSACTION")
  22. @SequenceGenerator(name = "FEETRANSPK", sequenceName = "FEETRANSID_SEQ")
  23. @Named("feeTransaction")
  24. @NamedQueries({
  25. @NamedQuery(
  26. name = FeeTransaction.UPDATE_ACTIVE_FOR_FEE_TRANSACTIONS_BY_DEAL_PRODUCT_IDS,
  27. query = "update FeeTransaction set active = false where dealProductId in (:dealProductIds) and active = 'Y' ")
  28. })
  29. public class FeeTransaction implements Serializable {
  30. //Attributes, getters, and setters
  31. }
  32.  
  33. public void updateActiveForVerbFeeTransactionsByFeeTransactionIds(Set<Long> dealProductIds) {
  34. entityManager.createNamedQuery(VerbFeeTransaction.UPDATE_ACTIVE_FOR_FEE_TRANSACTIONS_BY_DEAL_PRODUCT_IDS)
  35. .setParameter("dealProductIds", dealProductIds)
  36. .executeUpdate();
  37. }
  38.  
  39. private void handleDateChange(List<Long> dpIdList) {
  40. for(Long dpid : dpIdList) {
  41. updateFeeTransactionsForDateChange(dpid);
  42. }
  43. feeTransactionDAO.updateActiveForVerbFeeTransactionsByFeeTransactionIds(dpIdList);
  44. }
Add Comment
Please, Sign In to add comment