Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 1802 → Rev 1803

/branches/v3/impl/src/java/pt/estgp/estgweb/services/courseunits/SaveCourseUnitProgram.java
467,7 → 467,7
}
 
 
public void storeAllPrograms() throws IOException {
public void storeAllPrograms(boolean generate) throws IOException {
CourseUnitDaoImpl dao = DaoFactory.getCourseUnitDaoImpl();
Query q = AbstractDao.getCurrentSession().createQuery("select c from c in class " + CourseUnit.class.getName() + " where c.importYear = ?");
q.setString(0,DaoFactory.getConfigurationDaoImpl().getInterfaceImportYear());
486,7 → 486,10
try {
List<String> errors = new ArrayList<String>();
System.out.print("Sending " + next.getCourse().getName() + " - " + next.getSemestre() + " - " + next.getNormalizedName());
if(sendCurrentPdf2IonlineDontGeneratePdf(next, errors, null, client, null))
boolean result = generate ?
sendPdfFtpIonline(next, errors,null,client,null) : sendCurrentPdf2IonlineDontGeneratePdf(next, errors, null, client, null);
 
if(result)
System.out.print(" ... OK");
else
System.out.print(" ... FAIL probably no StreamID");
505,9 → 508,12
}
 
AbstractDao.getCurrentSession().evict(next);
logger.info(next.getName() + " done");
}
logger.info("Service Done");
client.quit();
client.disconnect();
logger.info("Disconnecting FTP Client");
 
}
 
515,7 → 521,8
public static void main(String[] args) throws IOException {
 
AbstractDao.getCurrentSession().beginTransaction();
new SaveCourseUnitProgram().storeAllPrograms();
new SaveCourseUnitProgram().storeAllPrograms(false);
logger.info("Flushing Database");
AbstractDao.getCurrentSession().flush();
AbstractDao.getCurrentSession().getTransaction().commit();
}