Methods Summary |
---|
public void | endRental()endRental
if ( theRental == null )
{
throw new CheckInDeviation( ERROR_ENDING_NON_STARTED_RENTAL );
}
else
{
theRental.checkIn();
if ( theRental.isLateReturn() )
{
OverdueRentalDTO aOverdueRentalDTO = makeOverdueRentalDTO();
theRental = null;
throw new LateReturnDeviation( aOverdueRentalDTO );
}
}
theRental = null;
return;
|
public CDRelease | getCdRelease()
return theCDRelease;
|
public PhysicalID | getPhysicalID()
return thePhysicalID;
|
public Rental | getRental()
return theRental;
|
public boolean | isRented()isRented
return ( theRental != null );
|
private OverdueRentalDTO | makeOverdueRentalDTO()makeOverdueRentalDTO
OverdueRentalDTO aOverdueRentalDTO = new OverdueRentalDTO();
aOverdueRentalDTO.theCDDiscPhysicalID = this.thePhysicalID;
aOverdueRentalDTO.theCDReleaseTitle = this.theCDRelease.
getTitle();
aOverdueRentalDTO.theCustomerID = this.theRental.getCustomer().
getCustomerID();
aOverdueRentalDTO.theCustomerName = this.theRental.getCustomer().
getName();
aOverdueRentalDTO.theOverdueFee = OVERDUE_FEE;
aOverdueRentalDTO.theRentalDueTime = this.theRental.getDueTime();
aOverdueRentalDTO.theRentalEndTime = this.theRental.getEndTime();
aOverdueRentalDTO.theRentalStartTime = this.theRental.
getStartTime();
return aOverdueRentalDTO;
|
private RentalContractDTO | makeRentalContractDTO(Customer aCustomer)makeOverdueRentalDTO
RentalContractDTO aRentalContractDTO = new RentalContractDTO();
aRentalContractDTO.theCDDiscPhysicalID = this.thePhysicalID;
aRentalContractDTO.theCDReleaseTitle = this.theCDRelease.getTitle();
aRentalContractDTO.theCustomerName = aCustomer.getName();
aRentalContractDTO.theRentalDueTime = this.theRental.getDueTime();
aRentalContractDTO.theRentalFee = this.theRental.getRentalFee();
aRentalContractDTO.theRentalStartTime = this.theRental.getStartTime();
return aRentalContractDTO;
|
public RentalContractDTO | startRental(Customer aCustomer)start_rental
int aBaseRentalPeriodDays =
theCDRelease.getBaseRentalPeriodDays();
Dollar rentalFee = theCDRelease.getRentalFee();
if ( theRental != null )
{
throw new CheckOutDeviation( ERROR_CDDISC_ALREADY_RENTED );
}
theRental = new Rental( aCustomer, aBaseRentalPeriodDays, rentalFee );
RentalContractDTO aRentalContractDTO = makeRentalContractDTO( aCustomer );
return aRentalContractDTO;
|