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 Details

    • Transaction

      public Transaction()
      Blank
    • Transaction

      public Transaction​(Staff staff, Member memberInvovled, Book bookInvovled)
      Constructor for every Transaction
      Parameters:
      staff - staff object
      memberInvovled - member object
      bookInvovled - 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 ID
      date - Transaction Date
      type - TransactionType Enumeration
      staff - staff object
      memberInvolved - member object
      bookInvolved - book object
      cashFlow - Double, you may set it to 0 if this field is not needed
  • Method Details

    • getType

      public TransactionType getType()
      Returns:
      return TransactionType enum - RENT, RESERVE and RETURN
    • setType

      public void setType​(TransactionType type)
      Parameters:
      type - set Transaction type - RENT, RESERVE, RETURN
    • getStaffHandled

      public Staff getStaffHandled()
      Returns:
      StaffID will be returned
    • setStaffHandled

      public void setStaffHandled​(Staff staffHandled)
      Parameters:
      staffHandled - staffID of this transaction, note that this will not validate with database whether if staffID is valid
    • getMemberInvolved

      public Member getMemberInvolved()
      Returns:
      return MemberID, can be 0 if the member was removed previously
    • setMemberInvolved

      public void setMemberInvolved​(Member memberInvovled)
      Parameters:
      memberInvovled - MemberID of this transaction, note that this will not validate with database whether if MemberID is valid
    • getBookInvolved

      public Book getBookInvolved()
      Returns:
      return BookID of this transaction, can be 0 if the book was previously removed
    • setBookInvovled

      public void setBookInvovled​(Book bookInvovled)
      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