private PdfPTable buildInfos(Fiche fiche) { PdfPCell cell; PdfPTable table = new PdfPTable(new float[] {1, 2}); table.setWidthPercentage(100); cell = new PdfPCell(new Phrase("NATURE DES FAITS: ", FONT_BOLD)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); if (fiche.getFaits() != null && !fiche.getFaits().isEmpty()) { String libelleFaits = ""; for (Fait fait : fiche.getFaits()) { libelleFaits += (("".equals(libelleFaits)) ? "" : ", ") + fait.getNombre() + " " + fait.getNature().getLibelleCourt(); } cell = new PdfPCell(new Phrase(libelleFaits, FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); } else { cell = new PdfPCell(new Phrase("", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); } cell = new PdfPCell(new Phrase("Quartier: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorderColorBottom(BaseColor.WHITE); table.addCell(cell); cell = new PdfPCell(new Phrase(fiche.getAdresse().getQuartier().getLibelle(), FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); cell = new PdfPCell(new Phrase("Secteur: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorderColorTop(BaseColor.WHITE); table.addCell(cell); cell = new PdfPCell( new Phrase(fiche.getAdresse().getQuartier().getSecteur().getLibelle(), FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); table.setSpacingBefore(5); table.setSpacingAfter(5); return table; }
@Override public byte[] buildReportFromFiche(Fiche fiche) throws DocumentException { logger.debug("Début méthode exportation PDF"); if (fiche.getAdresse() == null) { throw new BusinessException( "Impossible d'imprimer cette fiche : L'adresse n'est pas remplie."); } ByteArrayOutputStream bstream = new ByteArrayOutputStream(); logger.debug("Génération du PDF"); Document document = new Document(); PdfWriter.getInstance(document, bstream); document = buildMetadata(document, fiche); document.open(); document.add(buildHeader(fiche)); document.add(buildInfos(fiche)); document.add(buildSaisine(fiche)); document.add(buildExpose(fiche)); document.add(buildPersonnes(fiche)); document.add(buildProcedures(fiche)); document.close(); logger.debug("Fin de génération"); return bstream.toByteArray(); }
/** * Méthode de construction du contenu de la cellule "Situation initiale" * * @param fiche fiche concernée * @return contenu de la cellule */ static String construitLibelleSituationInitiale(Fiche fiche) { if (fiche == null) { return null; } if (StringUtils.isBlank(fiche.getSituationInitialeTitre())) { return "pas de détails"; } StringBuilder situInitiale = new StringBuilder(); situInitiale.append(StringUtils.trimToEmpty(fiche.getSituationInitialeTitre())); // #31572 : on suffixe le titre de "..." quand la situation initiale (libellé "long") est // renseignée pour indiquer à l'utilisateur que plus de détails se trouvent sur la fiche MC if (StringUtils.isNotBlank(fiche.getSituationInitiale())) { while (!situInitiale.toString().endsWith("...")) { situInitiale.append("."); } } return situInitiale.toString(); }
private PdfPTable buildHeader(Fiche fiche) { PdfPCell cell; PdfPTable table = new PdfPTable(3); table.setWidthPercentage(100); cell = new PdfPCell(new Phrase("POLICE MUNICIPALE", FONT_BOLD_WHITE)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.BLACK); table.addCell(cell); cell = new PdfPCell(new Phrase("MAIN COURANTE", FONT_TITLE)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setRowspan(2); table.addCell(cell); cell = new PdfPCell(new Phrase("N° fiche: " + fiche.getReference(), FONT_NORMAL_WHITE)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBackgroundColor(BaseColor.BLACK); table.addCell(cell); cell = new PdfPCell(new Phrase("NOUVELLE-CALÉDONIE", FONT_BOLD)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setPaddingTop(10); cell.setPaddingBottom(10); table.addCell(cell); cell = new PdfPCell(new Phrase("Ville de Nouméa", FONT_BOLD)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(cell); table.setSpacingBefore(5); table.setSpacingAfter(5); return table; }
private Document buildMetadata(Document document, Fiche fiche) { Agent a = fiche.getHistoriques().iterator().next().getUtilisateur().getAgent(); document.addAuthor(a.getNom() + " " + a.getPrenom()); document.addCreationDate(); document.addCreator( authHelper.getCurrentUser().getAgent().getNom() + " " + authHelper.getCurrentUser().getAgent().getPrenom()); document.addTitle("MAIN COURANTE " + fiche.getReference()); document.addSubject("MAIN COURANTE " + fiche.getReference()); StringBuilder keywords = new StringBuilder(); keywords.append(fiche.getReference()); keywords.append(","); keywords.append(fiche.getAdresse().getNomVoie().getLibelle()); keywords.append(","); for (Fait f : fiche.getFaits()) { keywords.append(f.getNature().getLibelleCourt()); keywords.append(","); } document.addKeywords(keywords.toString()); return document; }
private PdfPTable buildProcedures(Fiche fiche) { PdfPCell cell; PdfPTable table = new PdfPTable(new float[] {1, 3, 1, 1}); table.setWidthPercentage(100); cell = new PdfPCell(new Phrase("4_ Procédures", FONT_NORMAL)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(4); table.addCell(cell); /** Procedures */ cell = new PdfPCell(new Phrase("Catégories: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); boolean premiereProcedure = true; if (fiche.getProcedures() == null || fiche.getProcedures().isEmpty()) { cell = new PdfPCell(new Phrase("", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); cell = new PdfPCell(new Phrase("Numéros: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase("", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); } for (Procedure procedure : fiche.getProcedures()) { if (!premiereProcedure) { cell = new PdfPCell(new Phrase("", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); } cell = new PdfPCell(new Phrase(procedure.getCategorie().getLibelleLong(), FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); if (!premiereProcedure) { cell = new PdfPCell(new Phrase("", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); } else { cell = new PdfPCell(new Phrase("Numéros: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); premiereProcedure = false; } cell = new PdfPCell(new Phrase(procedure.getNumero(), FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); } table.setSpacingBefore(5); table.setSpacingAfter(5); return table; }
private PdfPTable buildPersonnes(Fiche fiche) { PdfPCell cell; PdfPTable table = new PdfPTable(new float[] {1, 1.5f, 2.5f, 1}); table.setWidthPercentage(100); cell = new PdfPCell(new Phrase("3_ Personnes concernées", FONT_NORMAL)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(4); table.addCell(cell); /** Appelants */ cell = new PdfPCell(new Phrase("Requérants: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); boolean premierAppelant = true; if (fiche.getAppelants() == null || fiche.getAppelants().isEmpty()) { cell = new PdfPCell(new Phrase("", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(2); table.addCell(cell); cell = new PdfPCell(new Phrase("", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); } for (Appelant appelant : fiche.getAppelants()) { if (!premierAppelant) { cell = new PdfPCell(new Phrase("", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); } else { premierAppelant = false; } cell = new PdfPCell(new Phrase(appelant.getRequerant(), FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(2); table.addCell(cell); cell = new PdfPCell(new Phrase(appelant.getNumero(), FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); } /** Personnes */ cell = new PdfPCell(new Phrase("Personnes: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); boolean premierePersonne = true; if (fiche.getPersonnes() == null || fiche.getPersonnes().isEmpty()) { cell = new PdfPCell(new Phrase("", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); cell = new PdfPCell(new Phrase("", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(2); table.addCell(cell); } for (Personne personne : fiche.getPersonnes()) { if (!premierePersonne) { cell = new PdfPCell(new Phrase("", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); } else { premierePersonne = false; } cell = new PdfPCell( new Phrase( (personne.getNombre() == null ? "" : (personne.getNombre() + " - ")) + personne.getCategorie().getLibelleLong(), FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); String nomAvecDetails = personne.getNom(); if (StringUtils.isNotBlank(personne.getDetails())) { nomAvecDetails += " - " + personne.getDetails(); } cell = new PdfPCell(new Phrase(nomAvecDetails, FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(2); table.addCell(cell); } table.setSpacingBefore(5); table.setSpacingAfter(5); return table; }
private PdfPTable buildExpose(Fiche fiche) { PdfPCell cell; PdfPTable table = new PdfPTable(new float[] {1, 0.5f, 4.5f}); table.setWidthPercentage(100); cell = new PdfPCell(new Phrase("2_ Exposé des faits ", FONT_NORMAL)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Phrase("GDH Appel: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); Date gdhAppelDate = fiche.getGdhAppel(); String pattern = "dd/MM/yyyy HH:mm"; SimpleDateFormat dateFormat = new SimpleDateFormat(pattern); String gdhAppel = dateFormat.format(gdhAppelDate); cell = new PdfPCell(new Phrase(gdhAppel, FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(2); table.addCell(cell); cell = new PdfPCell(new Phrase("GDH Arrivée: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); Date gdhArriveeDate = fiche.getGdhArrivee(); String gdhArrivee = ""; if (gdhArriveeDate != null) gdhArrivee = dateFormat.format(gdhArriveeDate); cell = new PdfPCell(new Phrase(gdhArrivee, FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(2); table.addCell(cell); cell = new PdfPCell(new Phrase("Lieu: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); String numeroRue = fiche.getAdresse().getNumeroVoie(); cell = new PdfPCell(new Phrase(numeroRue, FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); String libelleRue = fiche.getAdresse().getNomVoie().getLibelle(); cell = new PdfPCell(new Phrase(libelleRue, FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); cell = new PdfPCell(new Phrase("Précisions: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); String lieuPredefini = ""; if (fiche.getLieuPredefini() != null) lieuPredefini = fiche.getLieuPredefini().getLibelleLong().concat(" "); String adresseComplement = ""; if (fiche.getComplementAdresse() != null) adresseComplement = fiche.getComplementAdresse(); cell = new PdfPCell(new Phrase(lieuPredefini.concat(adresseComplement), FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(2); table.addCell(cell); cell = new PdfPCell(new Phrase("spacer", FONT_SPACER)); cell.setBorder(0); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Phrase("Titre: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase(fiche.getSituationInitialeTitre(), FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(2); table.addCell(cell); cell = new PdfPCell(new Phrase("spacer", FONT_SPACER)); cell.setBorder(0); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Phrase("Situation initiale: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); String situationInitiale = fiche.getSituationInitiale(); cell = new PdfPCell(new Paragraph(situationInitiale, FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); cell.setColspan(2); table.addCell(cell); cell = new PdfPCell(new Phrase("spacer", FONT_SPACER)); cell.setBorder(0); cell.setColspan(3); table.addCell(cell); table.setSpacingBefore(5); table.setSpacingAfter(5); return table; }
private PdfPTable buildSaisine(Fiche fiche) { PdfPCell cell; PdfPTable table = new PdfPTable(new float[] {1, 2.6f, 1.2f, 1.2f}); table.setWidthPercentage(100); cell = new PdfPCell(new Phrase("1_ Saisine ", FONT_NORMAL)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(4); table.addCell(cell); cell = new PdfPCell(new Phrase("Agent Créateur: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); Agent a = fiche.getHistoriques().iterator().next().getUtilisateur().getAgent(); cell = new PdfPCell(new Phrase(a.getNom() + " " + a.getPrenom(), FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Phrase("Cat. saisine: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); String catSaisine = fiche.getCategorieSaisine().getLibelleLong(); cell = new PdfPCell(new Phrase(catSaisine, FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); cell = new PdfPCell(new Phrase("Contact interpolice: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); String contactInterpolice = fiche.getContactInterpolice().getLibelleLong(); cell = new PdfPCell(new Phrase(contactInterpolice, FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); cell = new PdfPCell(new Phrase("Equipages: ", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); boolean premierePatrouille = true; if (fiche.getPatrouilles() == null || fiche.getPatrouilles().isEmpty()) { cell = new PdfPCell(new Phrase("", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(3); table.addCell(cell); } for (Patrouille patrouille : fiche.getPatrouilles()) { if (!premierePatrouille) { cell = new PdfPCell(new Phrase("", FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); } else { premierePatrouille = false; } String libelleEquipage = patrouille.getIndicatif().getLibelleLong(); libelleEquipage = libelleEquipage.concat(" : "); if (patrouille.getAgents() != null && patrouille.getAgents().size() > 0) { int cpt = 1; for (Agent agentPatrouille : patrouille.getAgents()) { libelleEquipage = libelleEquipage.concat(agentPatrouille.getNom() + " " + agentPatrouille.getPrenom()); if (cpt != patrouille.getAgents().size()) { libelleEquipage = libelleEquipage.concat(", "); cpt++; } } } cell = new PdfPCell(new Phrase(libelleEquipage, FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(2); table.addCell(cell); String vehicule = ""; if (patrouille.getVehicule() != null) { vehicule = patrouille.getVehicule().getImmatriculation(); } cell = new PdfPCell(new Phrase(vehicule, FONT_NORMAL)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); } table.setSpacingBefore(5); table.setSpacingAfter(5); return table; }
private PdfPTable buildTable(List<Fiche> fiches) throws DocumentException { PdfPTable table = new PdfPTable(9); table.setWidthPercentage(100); int[] widths = {14, 8, 28, 15, 20, 30, 30, 13, 33}; table.setWidths(widths); table.setHeaderRows(1); PdfPCell cell = new PdfPCell(new Phrase("N° Fiche", FONT_NORMAL)); cell.setFixedHeight(40); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("Heure", FONT_NORMAL)); cell.setFixedHeight(40); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("Nature des faits et nombre", FONT_NORMAL)); cell.setFixedHeight(40); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("Equipages", FONT_NORMAL)); cell.setFixedHeight(40); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("Quartier", FONT_NORMAL)); cell.setFixedHeight(40); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("Lieu", FONT_NORMAL)); cell.setFixedHeight(40); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("Personnes concernées", FONT_NORMAL)); cell.setFixedHeight(40); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("Procédures", FONT_NORMAL)); cell.setFixedHeight(40); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("Situation initiale", FONT_NORMAL)); cell.setFixedHeight(40); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); SimpleDateFormat hf = new SimpleDateFormat("HH:mm"); SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); DateTime currentDate = null; boolean addRowDate; for (Fiche f : fiches) { Historique creation = f.getHistoriques().iterator().next(); // Check if we need a new row to display the day addRowDate = false; if (currentDate == null) { currentDate = new DateTime(creation.getDateAction()); addRowDate = true; } else { DateTime lastDate = new DateTime(creation.getDateAction()); if (currentDate.getDayOfYear() != lastDate.getDayOfYear()) { currentDate = lastDate; addRowDate = true; } } if (addRowDate) { cell = new PdfPCell(new Phrase(df.format(currentDate.toDate()), FONT_NORMAL)); cell.setColspan(9); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); } // N° Fiche cell = new PdfPCell(new Phrase(f.getReference(), FONT_NORMAL)); table.addCell(cell); // Heure d'arrivée #31569 cell = f.getGdhAppel() != null ? new PdfPCell(new Phrase(hf.format(f.getGdhAppel()), FONT_NORMAL)) : new PdfPCell(); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); // Faits StringBuilder sb = new StringBuilder(); boolean first = true; for (Fait fa : f.getFaits()) { if (first) { first = false; } else { sb.append("\n"); } sb.append(fa.getNombre()).append(" ").append(fa.getNature().getLibelleLong()); } cell = new PdfPCell(new Phrase(sb.toString(), FONT_NORMAL)); table.addCell(cell); // Equipages sb = new StringBuilder(); first = true; for (Patrouille pa : f.getPatrouilles()) { if (first) { first = false; } else { sb.append("\n"); } sb.append(pa.getIndicatif().getLibelleLong()); } cell = new PdfPCell(new Phrase(sb.toString(), FONT_NORMAL)); table.addCell(cell); // Quartier cell = new PdfPCell(new Phrase(f.getAdresse().getQuartier().getLibelle(), FONT_NORMAL)); table.addCell(cell); // Lieu cell = new PdfPCell( new Phrase( f.getAdresse().getNumeroVoie() + " " + f.getAdresse().getNomVoie().getLibelle(), FONT_NORMAL)); table.addCell(cell); // Personnes sb = new StringBuilder(); first = true; for (Personne pe : f.getPersonnes()) { if (first) { first = false; } else { sb.append("\n"); } sb.append(pe.getCategorie().getLibelleLong()) .append(" : ") .append(StringUtils.isEmpty(pe.getNom()) ? "-" : pe.getNom()); } cell = new PdfPCell(new Phrase(sb.toString(), FONT_NORMAL)); table.addCell(cell); // Procedures sb = new StringBuilder(); first = true; for (Procedure pr : f.getProcedures()) { if (first) { first = false; } else { sb.append("\n"); } sb.append(pr.getCategorie().getLibelleCourt()).append(" - ").append(pr.getNumero()); } cell = new PdfPCell(new Phrase(sb.toString(), FONT_NORMAL)); table.addCell(cell); // Titre de la situation initiale cell = new PdfPCell( new Phrase(FicheEventReportHelper.construitLibelleSituationInitiale(f), FONT_NORMAL)); table.addCell(cell); } return table; }