Package my.edu.tarc.dco.bookrentalpos
Class Transaction
java.lang.Object
my.edu.tarc.dco.bookrentalpos.Entity
my.edu.tarc.dco.bookrentalpos.Transaction
- Direct Known Subclasses:
DiscountTransaction,RentTransaction,ReserveTransaction,ReturnTransaction
public class Transaction extends Entity
Class used to store transaction of the POS system
- Version:
- 1.0
- Author:
- Looz
-
Constructor Summary
Constructors Constructor Description Transaction()BlankTransaction(int id, String date, TransactionType type, Staff staff, Member memberInvolved, Book bookInvolved, double cashFlow)Constructor used for importing data from database
DO NOT use this to create new TransactionTransaction(Staff staff, Member memberInvovled, Book bookInvovled)Constructor for every Transaction -
Method Summary
Modifier and Type Method Description BookgetBookInvolved()doublegetCashFlow()MembergetMemberInvolved()StaffgetStaffHandled()TransactionTypegetType()voidsetBookInvovled(Book bookInvovled)voidsetCashFlow(double cashFlow)voidsetMemberInvolved(Member memberInvovled)voidsetStaffHandled(Staff staffHandled)voidsetType(TransactionType type)Methods inherited from class my.edu.tarc.dco.bookrentalpos.Entity
equals, getDateCreated, getId, getName, setDateCreated, setID, setName
-
Constructor Details
-
Transaction
public Transaction()Blank -
Transaction
Constructor for every Transaction- Parameters:
staff- staff objectmemberInvovled- member objectbookInvovled- book object
-
Transaction
public Transaction(int id, String date, TransactionType type, Staff staff, Member memberInvolved, Book bookInvolved, double cashFlow)Constructor used for importing data from database
DO NOT use this to create new Transaction- Parameters:
id- Transaction IDdate- Transaction Datetype- TransactionType Enumerationstaff- staff objectmemberInvolved- member objectbookInvolved- book objectcashFlow- Double, you may set it to 0 if this field is not needed
-
-
Method Details
-
getType
- Returns:
- return TransactionType enum - RENT, RESERVE and RETURN
-
setType
- Parameters:
type- set Transaction type - RENT, RESERVE, RETURN
-
getStaffHandled
- Returns:
- StaffID will be returned
-
setStaffHandled
- Parameters:
staffHandled- staffID of this transaction, note that this will not validate with database whether if staffID is valid
-
getMemberInvolved
- Returns:
- return MemberID, can be 0 if the member was removed previously
-
setMemberInvolved
- Parameters:
memberInvovled- MemberID of this transaction, note that this will not validate with database whether if MemberID is valid
-
getBookInvolved
- Returns:
- return BookID of this transaction, can be 0 if the book was previously removed
-
setBookInvovled
- Parameters:
bookInvovled- bookID of this transaction, note that this will not validate with database whether if BookID is valid
-
getCashFlow
public double getCashFlow()- Returns:
- cash flow of this transaction. Refer to different sub-classes of Transaction for how its being used
- See Also:
DiscountTransaction,RentTransaction,ReturnTransaction
-
setCashFlow
public void setCashFlow(double cashFlow)- Parameters:
cashFlow- cashFlow of the Transaction
-