FileDocCategorySizeDatePackage
Reports.javaAPI DocExample2543Wed May 04 06:18:14 BST 2005com.samscdrental.reports

Reports

public class Reports extends Object

Title: Sams CD Rental Store

Description:

Copyright: Copyright (c) 2004

Company:

author
Ken Pugh
version
1.0

Fields Summary
private static String
PRINTER_FILENAME
private static final String
ERROR_CANNOT_OPEN_PRINTER
private static final String
ERROR_CANNOT_WRITE_TO_PRINTER
private static final String
ERROR_CANNOT_CLOSE_PRINTER
Constructors Summary
private Reports()


	
Methods Summary
public static ContractReportPlainTextFormatcreateContractReport(RentalContractDTO aRentalContractDTO)
printContractReport

param
aRentalContractDTO RentalContractDTO

		ContractReportPlainTextFormat aContractReportPlainTextFormat
			= new ContractReportPlainTextFormat( aRentalContractDTO );
		return aContractReportPlainTextFormat;
	
public static OverdueRentalReportPlainTextFormatcreateOverdueRentalReport(OverdueRentalDTO aOverdueRentalDTO)

		OverdueRentalReportPlainTextFormat aOverdueRentalReportPlainTextFormat
			= new OverdueRentalReportPlainTextFormat( aOverdueRentalDTO );
		return aOverdueRentalReportPlainTextFormat;
	
private static java.lang.StringgetFilename()

		Configuration configuration = Configuration.getInstance();
		ReportConfiguration rc = configuration.getReportConfiguration();
		return rc.printFilename;
	
public static voidprintReport(ReportPlainTextFormat aReportPlainTextFormat)

		FileWriter output = null;
		try
		{
			output = new FileWriter( PRINTER_FILENAME );
		}
		catch ( IOException exception )
		{
			throw new PrinterFailureDeviation( ERROR_CANNOT_OPEN_PRINTER + " " +
											   PRINTER_FILENAME +
											   exception.getMessage() );
		}
		try
		{
			output.write( aReportPlainTextFormat.getReportString() );

		}
		catch ( IOException exception )
		{
			throw new PrinterFailureDeviation( ERROR_CANNOT_WRITE_TO_PRINTER +
											   exception.getMessage() );
		}

		finally
		{
			try
			{
				output.close();
			}
			catch ( IOException exception )
			{
				throw new PrinterFailureDeviation( ERROR_CANNOT_CLOSE_PRINTER +
					exception.getMessage() );
			}
		}