public List<Project> fetchProjectsByBarcode(String barcode) { PersistentStoreConnection connection = null; try { connection = BreedingTechCommonPersistentStoreFactory.getDefaultConnection(); return projectDao.fetchProjectsByBarcode(connection, barcode); } catch (WrappingException e) { throw new ChippingManagerException(e); } finally { BreedingTechCommonPersistentStoreFactory.closeQuietly(connection); } }
public Report runReport(ReportType type, String stringVar, Date date) throws SeedSorterException { Report report; PersistentStoreConnection connection = null; try { connection = BreedingTechCommonPersistentStoreFactory.getDefaultConnection(); ReportDAO dao = new ReportDAO(connection); switch (type) { case CHIPPED_SEED_LOCATIONS: report = dao.runChippedSeedLocationsReport(stringVar); break; case LATEST_SEED_STORE_ORDERS: report = dao.runLatestSeedStoreOrdersReport(date); break; case MOISTURE_UPDATES: report = dao.runMoistureUpdatesReport(); break; case READY_FOR_CHIPPING: report = dao.runReadyForChippingReport(); break; case READY_FOR_OFFLOADING: report = dao.runReadyForOffloadingReport(); break; case SEED_PLATE_INFO: report = dao.runSeedPlateInfoReport(stringVar); break; case SEED_STORE_ORDERS: report = dao.runSeedStoreOrdersReport(date); break; default: report = null; } } catch (WrappingException e) { throw new SeedSorterException(e); } finally { BreedingTechCommonPersistentStoreFactory.closeQuietly(connection); } return report; }
protected void closeConnection(PersistentStoreConnection connection) { BreedingTechCommonPersistentStoreFactory.closeQuietly(connection); }
protected PersistentStoreConnection getConnection() throws WrappingException { return BreedingTechCommonPersistentStoreFactory.getDefaultConnection(); }