Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @OneToMany(cascade = Array(CascadeType.ALL))
- @OrderBy
- private var _items: List[InvoiceItem] = new ArrayList
- @Basic(optional = false)
- private var _totalAmount: BigDecimal = BigDecimal.ZERO
- @Temporal(TemporalType.DATE)
- private var _sentDate: Date = _
- def sent_? = _sentDate != null
- def removeItem(index: Int) {
- require(!sent_?, "items cannot be changed after invoice is sent")
- val item = _items.remove(index)
- _totalAmount = _totalAmount.subtract(item.amount)
- }
Add Comment
Please, Sign In to add comment