use of com.tomasio.projects.trainning.dto.CurriculoMinimoDTO in project trainning by fernandotomasio.
the class DOC002PDF method makeReport.
@Override
public void makeReport() {
teachingDocumentsService = (TeachingDocumentsService) services.get("teachingDocumentsService");
document = documentManager.getDocumentPortrait();
os = documentManager.prepareDocument(document);
writer = documentManager.getWritter();
ChapterSectionTOC eventHandler = new ChapterSectionTOC();
writer.setPageEvent(eventHandler);
document.open();
try {
String curriculoMinimoIdParam = (String) params.get("curriculoMinimoId");
Long curriculoMinimoId = Long.parseLong(curriculoMinimoIdParam);
CurriculoMinimoDTO curriculoMinimo = teachingDocumentsService.findCurriculoMinimo(curriculoMinimoId);
buildCover(document, curriculoMinimo);
buildFrontispicio(document, curriculoMinimo);
document.add(buildPrefacio(curriculoMinimo));
document.add(Chunk.NEXTPAGE);
document.add(buildAbreviaturas(curriculoMinimo));
document.add(Chunk.NEXTPAGE);
document.add(buildDisposicoesPreliminares(curriculoMinimo));
document.add(Chunk.NEXTPAGE);
document.add(buildAtividadesComplementares(curriculoMinimo));
document.add(Chunk.NEXTPAGE);
document.add(buildComplementacaoInstrucao(curriculoMinimo));
document.add(Chunk.NEXTPAGE);
// PdfPTable tableAtividadesAvaliativas = buildAtividadesAvaliativasTable(curriculoMinimo);
// document.add(tableAtividadesAvaliativas);
Paragraph p12 = new Paragraph();
p12.add(new Phrase("4 DETALHAMENTO DAS UNIDADES DIDÁTICAS", fontManager.getBoldFont()));
document.add(p12);
document.add(Chunk.NEWLINE);
DisciplinaDTO[] disciplinas = teachingDocumentsService.findAllDisciplinasByCurriculoMinimo(curriculoMinimo.getId());
for (DisciplinaDTO disciplina : disciplinas) {
PdfPTable tableDisciplina = buildTableDisciplina(disciplina);
document.add(tableDisciplina);
document.add(Chunk.NEWLINE);
UnidadeDidaticaDTO[] unidades = teachingDocumentsService.findAllUnidadesDidaticas(disciplina.getId());
PdfPTable unidadesHeaderTable = new PdfPTable(1);
unidadesHeaderTable.setWidthPercentage(100);
PdfPCell p20 = new PdfPCell(new Phrase("UNIDADES DIDÁTICAS", fontManager.getBoldFont()));
unidadesHeaderTable.addCell(p20);
unidadesHeaderTable.setHorizontalAlignment(Element.ALIGN_CENTER);
document.add(unidadesHeaderTable);
document.add(Chunk.NEWLINE);
for (UnidadeDidaticaDTO unidade : unidades) {
PdfPTable tableUnidade = buildTableUnidade(unidade);
document.add(tableUnidade);
document.add(Chunk.NEWLINE);
}
PdfPTable tableRecomendacoes = buildTableRecomendacoesMetodologicas(disciplina);
document.add(tableRecomendacoes);
document.add(Chunk.NEWLINE);
PdfPTable perfisTable = buildTablePerfisRelacionamento(disciplina);
document.add(perfisTable);
document.add(Chunk.NEWLINE);
PdfPTable referenciasTable = buildTableReferencias(disciplina);
document.add(referenciasTable);
document.add(Chunk.NEXTPAGE);
}
document.add(Chunk.NEXTPAGE);
document.add(buildDisposicoesFinais(curriculoMinimo));
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
document.add(buildAssinatura());
document.add(Chunk.NEXTPAGE);
document.add(buildSumario(eventHandler.titles));
} catch (DocumentException e) {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, e);
throw new CoreException(e.getMessage());
} finally {
document.close();
}
try {
PdfReader reader = new PdfReader(os.toByteArray());
int n = reader.getNumberOfPages();
String pagesInterval = String.format("1-4,%d, 5-%d", n, n - 1);
reader.selectPages(pagesInterval);
os = new ByteArrayOutputStream();
PdfStamper stamper = new PdfStamper(reader, os);
stamper.close();
reader.close();
} catch (IOException ex) {
Logger.getLogger(DOC002PDF.class.getName()).log(Level.SEVERE, null, ex);
} catch (DocumentException ex) {
Logger.getLogger(DOC002PDF.class.getName()).log(Level.SEVERE, null, ex);
}
try {
PdfReader reader = new PdfReader(os.toByteArray());
os = new ByteArrayOutputStream();
PdfStamper stamper = new PdfStamper(reader, os);
int total = reader.getNumberOfPages();
PdfContentByte over = null;
int total_pages = total - 1;
for (int i = 1; i < total; i++) {
int actual_page = i - 1;
if (i > 5) {
over = stamper.getOverContent(i);
System.out.println(over);
over.beginText();
BaseFont baseFont = BaseFont.createFont(BaseFont.TIMES_ROMAN, "UTF-8", false);
over.setFontAndSize(baseFont, 12);
if ((i % 2) == 0) {
over.showTextAligned(PdfContentByte.ALIGN_RIGHT, actual_page + "/" + total_pages, 538, 803, 0);
} else {
over.showTextAligned(PdfContentByte.ALIGN_LEFT, actual_page + "/" + total_pages, 58, 803, 0);
}
over.endText();
}
}
// PdfContentByte content = stamper.getOverContent(1);
// ColumnText ct = new ColumnText( content );
// ct.setSimpleColumn(50,50,50,50);
// ct.setText(new Phrase("TESTANDO"));
// ct.go();
stamper.close();
reader.close();
} catch (IOException ex) {
// Logger.getLogger(DOC001PDF.class.getName()).log(Level.SEVERE, null, ex);
} catch (DocumentException ex) {
Logger.getLogger(DOC001PDF.class.getName()).log(Level.SEVERE, null, ex);
}
}
use of com.tomasio.projects.trainning.dto.CurriculoMinimoDTO in project trainning by fernandotomasio.
the class ApostilasController method go.
@RequestMapping("/go")
public String go(Model model, WebRequest request) {
String curriculoMinimoIdParam = request.getParameter("curriculoMinimoId");
if (curriculoMinimoIdParam == null) {
model.addAttribute("curriculosDataList", initializeCurriculosDataList());
return "apostilas/select_cm";
}
Long curriculoMinimoId = Long.parseLong(curriculoMinimoIdParam);
CurriculoMinimoDTO curriculo = teachingDocumentsService.findCurriculoMinimo(curriculoMinimoId);
model.addAttribute("curriculoMinimo", curriculo);
return "redirect:/apostilas";
}
use of com.tomasio.projects.trainning.dto.CurriculoMinimoDTO in project trainning by fernandotomasio.
the class CommonsController method initializeSelectableCurriculos.
public Map<Object, Object> initializeSelectableCurriculos() {
Map<Object, Object> result = new HashMap<>();
CurriculoMinimoDTO[] curriculos = teachingDocumentsService.findAllCurriculosMinimos();
for (CurriculoMinimoDTO curriculo : curriculos) {
result.put(curriculo.getId(), curriculo.getCurso().getCodigo() + " - " + curriculo.getCurso().getDescricao());
}
return result;
}
use of com.tomasio.projects.trainning.dto.CurriculoMinimoDTO in project trainning by fernandotomasio.
the class CurriculosMinimosController method saveDisciplina.
public void saveDisciplina(DisciplinaCMForm disciplinaCMForm) {
RequestContext requestContext = RequestContextHolder.getRequestContext();
CurriculoMinimoForm cmForm = requestContext.getFlowScope().get("cMForm", CurriculoMinimoForm.class);
CurriculoMinimoDTO curriculoMinimo = teachingDocumentsService.findCurriculoMinimo(cmForm.getId());
DisciplinaDTO disciplina = new DisciplinaDTO();
disciplina.setNumeroDisciplina(disciplinaCMForm.getNumero());
disciplina.setId(disciplinaCMForm.getId());
disciplina.setDescricao(disciplinaCMForm.getDescricao());
disciplina.setQuantidadeTemposAula(disciplinaCMForm.getCargaHorariaInstrucao());
disciplina.setQuantidadeTemposAvaliacao(disciplinaCMForm.getCargaHorariaAvaliacao());
disciplina.setCurriculoMinimo(curriculoMinimo);
AreaEnsinoDTO area = teachingDocumentsService.findAreaConhecimento(disciplinaCMForm.getAreaEnsinoId());
disciplina.setAreaEnsino(area);
CampoDTO campo = teachingDocumentsService.findCampo(disciplinaCMForm.getCampoId());
disciplina.setCampo(campo);
disciplinaCMForm.setCampoLabel(campo.getDescricao());
disciplinaCMForm.setAreaEnsinoLabel(area.getNome());
if (disciplina.getId() == null) {
Long id = teachingDocumentsService.createDisciplina(disciplina);
disciplinaCMForm.setId(id);
List<DisciplinaCMForm> disciplinasDataList = cmForm.getDisciplinasDataList();
disciplinasDataList.add(disciplinaCMForm);
} else {
teachingDocumentsService.updateDisciplina(disciplina);
}
}
use of com.tomasio.projects.trainning.dto.CurriculoMinimoDTO in project trainning by fernandotomasio.
the class CurriculosMinimosController method saveStep7.
public void saveStep7(CurriculoMinimoForm form) {
CMFormStep7 cMFormStep7 = form.getcMFormStep7();
CurriculoMinimoDTO curriculoMinimo = teachingDocumentsService.findCurriculoMinimo(form.getId());
curriculoMinimo.setDisposicoesGerais(cMFormStep7.getDisposicoesGerais());
teachingDocumentsService.updateCurriculoMinimo(curriculoMinimo);
}
Aggregations