1 package net.firstpartners.nounit.report; 2 3 26 27 import net.firstpartners.nounit.ui.common.CommandPackage; 28 import net.firstpartners.nounit.utility.NoUnitException; 29 30 33 public class ReportPicker { 34 35 45 public static IReport getReportMaker(CommandPackage inCommandPackage) 46 throws NoUnitException { 47 48 IReport outReport = null; 50 Object tmpObject = new Object (); 51 52 String reportName = inCommandPackage.getString(CommandPackage.REPORT_CLASS); 54 55 if ((reportName==null)||(reportName.equals(""))) { 57 throw new NoUnitException ("Please Specify a report name"); 58 } 59 60 62 try { 63 64 Class outReportClass = Class.forName(reportName); 65 if (outReportClass != null) { 66 outReport = (IReport)outReportClass.newInstance(); 67 } 68 69 } catch (ClassNotFoundException cnfe) { 70 throw new NoUnitException("Could not find Report:"+reportName); 71 } catch (InstantiationException ie) { 72 throw new NoUnitException("Could not create Report:"+reportName); 73 } catch (IllegalAccessException iae) { 74 throw new NoUnitException("Error in creating Report:"+reportName); 75 } 76 77 return outReport; 78 } 79 80 } | Popular Tags |