Rev 1801 | Rev 1814 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1801 | Rev 1803 | ||
---|---|---|---|
Line 465... | Line 465... | ||
465 | out.close(); |
465 | out.close(); |
466 | return path; |
466 | return path; |
467 | } |
467 | } |
468 | 468 | ||
469 | 469 | ||
470 | public void storeAllPrograms() throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
470 | public void storeAllPrograms(boolean generate) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
471 | CourseUnitDaoImpl dao = DaoFactory.getCourseUnitDaoImpl(); |
471 | CourseUnitDaoImpl dao = DaoFactory.getCourseUnitDaoImpl(); |
472 | 1.5.0/docs/api/javax/management/Query.html">Query q = AbstractDao.getCurrentSession().createQuery("select c from c in class " + CourseUnit.class.getName() + " where c.importYear = ?"); |
472 | 1.5.0/docs/api/javax/management/Query.html">Query q = AbstractDao.getCurrentSession().createQuery("select c from c in class " + CourseUnit.class.getName() + " where c.importYear = ?"); |
473 | q.setString(0,DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear()); |
473 | q.setString(0,DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear()); |
474 | Iterator<CourseUnit> cuIter = q.iterate(); |
474 | Iterator<CourseUnit> cuIter = q.iterate(); |
475 | FtpServer server = FtpServer.getNewServer(Globals.FTP_IONLINE_URL,Globals.FTP_IONLINE_USER,Globals.FTP_IONLINE_PASS); |
475 | FtpServer server = FtpServer.getNewServer(Globals.FTP_IONLINE_URL,Globals.FTP_IONLINE_USER,Globals.FTP_IONLINE_PASS); |
Line 484... | Line 484... | ||
484 | CourseUnit next = cuIter.next(); |
484 | CourseUnit next = cuIter.next(); |
485 | 485 | ||
486 | try { |
486 | try { |
487 | List<String> errors = new ArrayList<String>(); |
487 | List<String> errors = new ArrayList<String>(); |
488 | 1.5.0/docs/api/java/lang/System.html">System.out.print("Sending " + next.getCourse().getName() + " - " + next.getSemestre() + " - " + next.getNormalizedName()); |
488 | 1.5.0/docs/api/java/lang/System.html">System.out.print("Sending " + next.getCourse().getName() + " - " + next.getSemestre() + " - " + next.getNormalizedName()); |
- | 489 | boolean result = generate ? |
|
489 | if(sendCurrentPdf2IonlineDontGeneratePdf(next, errors, null, client, null)) |
490 | sendPdfFtpIonline(next, errors,null,client,null) : sendCurrentPdf2IonlineDontGeneratePdf(next, errors, null, client, null); |
- | 491 | ||
- | 492 | if(result) |
|
490 | 1.5.0/docs/api/java/lang/System.html">System.out.print(" ... OK"); |
493 | 1.5.0/docs/api/java/lang/System.html">System.out.print(" ... OK"); |
491 | else |
494 | else |
492 | 1.5.0/docs/api/java/lang/System.html">System.out.print(" ... FAIL probably no StreamID"); |
495 | 1.5.0/docs/api/java/lang/System.html">System.out.print(" ... FAIL probably no StreamID"); |
493 | 1.5.0/docs/api/java/lang/System.html">System.out.print("\n"); |
496 | 1.5.0/docs/api/java/lang/System.html">System.out.print("\n"); |
494 | if(errors.size()>0) |
497 | if(errors.size()>0) |
Line 503... | Line 506... | ||
503 | }catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable e) { |
506 | }catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable e) { |
504 | e.printStackTrace(); |
507 | e.printStackTrace(); |
505 | } |
508 | } |
506 | 509 | ||
507 | AbstractDao.getCurrentSession().evict(next); |
510 | AbstractDao.getCurrentSession().evict(next); |
- | 511 | logger.info(next.getName() + " done"); |
|
508 | } |
512 | } |
- | 513 | logger.info("Service Done"); |
|
509 | client.quit(); |
514 | client.quit(); |
510 | client.disconnect(); |
515 | client.disconnect(); |
- | 516 | logger.info("Disconnecting FTP Client"); |
|
511 | 517 | ||
512 | } |
518 | } |
513 | 519 | ||
514 | 520 | ||
515 | public static void main(1.5.0/docs/api/java/lang/String.html">String[] args) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
521 | public static void main(1.5.0/docs/api/java/lang/String.html">String[] args) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
516 | 522 | ||
517 | AbstractDao.getCurrentSession().beginTransaction(); |
523 | AbstractDao.getCurrentSession().beginTransaction(); |
518 | new SaveCourseUnitProgram().storeAllPrograms(); |
524 | new SaveCourseUnitProgram().storeAllPrograms(false); |
- | 525 | logger.info("Flushing Database"); |
|
519 | AbstractDao.getCurrentSession().flush(); |
526 | AbstractDao.getCurrentSession().flush(); |
520 | AbstractDao.getCurrentSession().getTransaction().commit(); |
527 | AbstractDao.getCurrentSession().getTransaction().commit(); |
521 | } |
528 | } |
522 | 529 | ||
523 | } |
530 | } |