Rev 1705 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1705 | Rev 1830 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | import pt.estgp.estgweb.domain.OlapStarFactQuestionarioAnswer; |
7 | import pt.estgp.estgweb.domain.OlapStarFactQuestionarioAnswer; |
8 | import pt.estgp.estgweb.domain.QuestionarioReportFileAno; |
8 | import pt.estgp.estgweb.domain.QuestionarioReportFileAno; |
9 | import pt.estgp.estgweb.domain.QuestionarioReportFileGroupAno; |
9 | import pt.estgp.estgweb.domain.QuestionarioReportFileGroupAno; |
10 | import pt.estgp.estgweb.domain.dao.DaoFactory; |
10 | import pt.estgp.estgweb.domain.dao.DaoFactory; |
11 | import pt.estgp.estgweb.filters.chains.ResourceAccessControlEnum; |
11 | import pt.estgp.estgweb.filters.chains.ResourceAccessControlEnum; |
- | 12 | import pt.estgp.estgweb.services.data.IRepositoryFile; |
|
12 | import pt.estgp.estgweb.services.data.RepositoryService; |
13 | import pt.estgp.estgweb.services.data.RepositoryService; |
13 | import pt.estgp.estgweb.services.questionarios.PedagogicoAlunosProcessor; |
14 | import pt.estgp.estgweb.services.questionarios.PedagogicoAlunosProcessor; |
14 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.queries.PerguntasGrupoQueryDao; |
15 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.queries.PerguntasGrupoQueryDao; |
15 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.queries.QueryDaoUtils; |
16 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.queries.QueryDaoUtils; |
16 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.queries.QuestionariosQueryDao; |
17 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.queries.QuestionariosQueryDao; |
Line 25... | Line 26... | ||
25 | import java.io.FileNotFoundException; |
26 | import java.io.FileNotFoundException; |
26 | import java.io.IOException; |
27 | import java.io.IOException; |
27 | import java.text.DecimalFormat; |
28 | import java.text.DecimalFormat; |
28 | import java.util.ArrayList; |
29 | import java.util.ArrayList; |
29 | import java.util.List; |
30 | import java.util.List; |
- | 31 | import java.util.zip.ZipInputStream; |
|
30 | 32 | ||
31 | /** |
33 | /** |
32 | * Created by jorgemachado on 16/12/16. |
34 | * Created by jorgemachado on 16/12/16. |
33 | */ |
35 | */ |
34 | public abstract class ReportAlunosGenerator extends ReportGenerator |
36 | public abstract class ReportAlunosGenerator extends ReportGenerator |
Line 441... | Line 443... | ||
441 | null, DaoFactory.getUserDaoImpl().load(new 1.5.0/docs/api/java/lang/Long.html">Long(1))); |
443 | null, DaoFactory.getUserDaoImpl().load(new 1.5.0/docs/api/java/lang/Long.html">Long(1))); |
442 | q.setRepositoryStreamZipFile(repositoryStreamCode); |
444 | q.setRepositoryStreamZipFile(repositoryStreamCode); |
443 | } |
445 | } |
444 | else |
446 | else |
445 | { |
447 | { |
446 | new RepositoryService().updateRepositoryFile( |
448 | new RepositoryService().replaceLastRepositoryFileVersion( |
447 | q.getRepositoryStreamZipFile(), |
449 | q.getRepositoryStreamZipFile(), |
448 | new 1.5.0/docs/api/java/io/FileInputStream.html">FileInputStream(zipFile), |
450 | new 1.5.0/docs/api/java/io/FileInputStream.html">FileInputStream(zipFile), |
449 | "application/zip", |
451 | "application/zip", |
450 | "zip", |
452 | "zip", |
451 | (int)zipFile.length(), |
453 | (int) zipFile.length(), |
452 | zipFile.getName(), |
454 | zipFile.getName(), |
453 | desc, |
455 | desc, |
454 | access); |
456 | access); |
455 | } |
457 | } |
456 | zipFile.delete(); |
458 | zipFile.delete(); |
457 | } |
459 | } |
458 | 460 | ||
- | 461 | ||
- | 462 | public void unZipFolder(QuestionarioReportFileGroupAno q, 1.5.0/docs/api/java/io/File.html">File reportGroupFolder) throws 1.5.0/docs/api/java/io/IOException.html">IOException |
|
- | 463 | { |
|
- | 464 | IRepositoryFile zipRepoFile = new RepositoryService().load(q.getRepositoryStreamZipFile(), null); |
|
- | 465 | FilesUtils.uzip2Folder(reportGroupFolder.getAbsolutePath(),new 1.5.0/docs/api/java/util/zip/ZipInputStream.html">ZipInputStream(zipRepoFile.getInput())); |
|
- | 466 | zipRepoFile.getInput().close(); |
|
- | 467 | } |
|
- | 468 | ||
459 | protected void sendPdfToRepository(QuestionarioReportFileAno reportFile, 1.5.0/docs/api/java/io/File.html">File tmpFile, 1.5.0/docs/api/java/lang/String.html">String descricao,ResourceAccessControlEnum access) throws 1.5.0/docs/api/java/io/FileNotFoundException.html">FileNotFoundException { |
469 | protected void sendPdfToRepository(QuestionarioReportFileAno reportFile, 1.5.0/docs/api/java/io/File.html">File tmpFile, 1.5.0/docs/api/java/lang/String.html">String descricao,ResourceAccessControlEnum access) throws 1.5.0/docs/api/java/io/FileNotFoundException.html">FileNotFoundException { |
460 | if(reportFile.getRepositoryStream() == null || reportFile.getRepositoryStream().trim().length() == 0) |
470 | if(reportFile.getRepositoryStream() == null || reportFile.getRepositoryStream().trim().length() == 0) |
461 | { |
471 | { |
462 | 1.5.0/docs/api/java/lang/String.html">String repositoryStreamCode = new RepositoryService().storeRepositoryFile( |
472 | 1.5.0/docs/api/java/lang/String.html">String repositoryStreamCode = new RepositoryService().storeRepositoryFile( |
463 | new 1.5.0/docs/api/java/io/FileInputStream.html">FileInputStream(tmpFile), |
473 | new 1.5.0/docs/api/java/io/FileInputStream.html">FileInputStream(tmpFile), |
Line 471... | Line 481... | ||
471 | DaoFactory.getUserDaoImpl().load(new 1.5.0/docs/api/java/lang/Long.html">Long(1))); |
481 | DaoFactory.getUserDaoImpl().load(new 1.5.0/docs/api/java/lang/Long.html">Long(1))); |
472 | reportFile.setRepositoryStream(repositoryStreamCode); |
482 | reportFile.setRepositoryStream(repositoryStreamCode); |
473 | } |
483 | } |
474 | else |
484 | else |
475 | { |
485 | { |
476 | new RepositoryService().updateRepositoryFile( |
486 | new RepositoryService().replaceLastRepositoryFileVersion( |
477 | reportFile.getRepositoryStream(), |
487 | reportFile.getRepositoryStream(), |
478 | new 1.5.0/docs/api/java/io/FileInputStream.html">FileInputStream(tmpFile), |
488 | new 1.5.0/docs/api/java/io/FileInputStream.html">FileInputStream(tmpFile), |
479 | "application/pdf", |
489 | "application/pdf", |
480 | "pdf", |
490 | "pdf", |
481 | (int)tmpFile.length(), |
491 | (int)tmpFile.length(), |