Guest User

Untitled

a guest
Jul 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. @OneToMany(cascade = Array(CascadeType.ALL))
  2. @OrderBy
  3. private var _items: List[InvoiceItem] = new ArrayList
  4.  
  5. @Basic(optional = false)
  6. private var _totalAmount: BigDecimal = BigDecimal.ZERO
  7.  
  8. @Temporal(TemporalType.DATE)
  9. private var _sentDate: Date = _
  10.  
  11. def sent_? = _sentDate != null
  12.  
  13. def removeItem(index: Int) {
  14. require(!sent_?, "items cannot be changed after invoice is sent")
  15. val item = _items.remove(index)
  16. _totalAmount = _totalAmount.subtract(item.amount)
  17. }
Add Comment
Please, Sign In to add comment