My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.extensiblejava.bill;

import com.extensiblejava.audit.*;
import java.math.*;
import com.extensiblejava.bill.data.*;

public class Bill implements Auditable {

private BillDataBean billData;

public static Bill loadBill(BillEntityLoader loader) {
return loader.loadBill();
}
public Bill(BillDataBean billData) {
this.billData = billData;
}

public String getBillId() { return this.billData.getBillId().toString(); }
public String getName() { return this.billData.getName(); }
public BigDecimal getAmount() { return this.billData.getAmount(); }
public BigDecimal getAuditedAmount() { return (this.billData.getAuditedAmount() == null ? null : this.billData.getAuditedAmount()); }
public BigDecimal getPaidAmount() { return this.billData.getPaidAmount(); }
public String getStatus() {
if (this.billData.getPaidAmount() != null) {
return "PAID";
} else if (this.billData.getAuditedAmount() != null) {
return "AUDITED";
} else {
return "NEW";
}
}

public void audit(AuditFacade auditor) throws AuditException {
this.billData.setAuditedAmount(auditor.audit(this));
this.persist();
}

public void pay(BillPayer payer) {
if (this.billData.getPaidAmount() == null) {
this.billData.setPaidAmount(payer.generateDraft(this));
this.persist();
}
}

private void persist() {
BillDb.update(billData);
}
}

Change log

r73 by pragkirk on Nov 5, 2009   Diff
Initial Version
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 1401 bytes, 48 lines
Powered by Google Project Hosting