Newer
Older
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package edu.ncsu.csc.itrust.action;
import edu.ncsu.csc.itrust.beans.BillingBean;
import edu.ncsu.csc.itrust.beans.OfficeVisitBean;
import edu.ncsu.csc.itrust.dao.DAOFactory;
import edu.ncsu.csc.itrust.dao.mysql.BillingDAO;
import edu.ncsu.csc.itrust.dao.mysql.OfficeVisitDAO;
import edu.ncsu.csc.itrust.exception.DBException;
/**
* VerifyClaimAction handles the interaction between a user and the
* DAOs.
*/
public class VerifyClaimAction {
/**The DAO to access the billing table*/
private BillingDAO billAccess;
/**The DAO to access the office visits DAO*/
private OfficeVisitDAO ovAccess;
/**The bill that we are verifying*/
private BillingBean bill;
/**The office visit associated with the bill*/
private OfficeVisitBean ov;
/**
* VerifyClaimAction simply initializes the instance variables.
* @param factory The DAO factory
* @param bID The ID of the bill.
*/
public VerifyClaimAction(DAOFactory factory, long bID){
billAccess = factory.getBillingDAO();
ovAccess = factory.getOfficeVisitDAO();
try {
bill = billAccess.getBillId(bID);
ov = ovAccess.getOfficeVisit(bill.getApptID());
} catch (DBException e) {
e.printStackTrace();
}
}
/**
* getBill returns the bill we are handling.
* @return The billing bean.
*/
public BillingBean getBill(){
return this.bill;
}
/**
* getOV returns the office visit we are handling.
* @return The office visit bean.
*/
public OfficeVisitBean getOV(){
return this.ov;
}
/**
* denyClaim handles the user choosing to deny the claim.
*/
public void denyClaim(){
bill.setStatus("Denied");
try {
this.billAccess.editBill(bill);
} catch (DBException e) {
e.printStackTrace();
}
}
/**
* approveClaim handles the user choosing to approve the claim.
*/
public void approveClaim(){
bill.setStatus("Approved");
try {
this.billAccess.editBill(bill);
} catch (DBException e) {
e.printStackTrace();
}
}
}