Class AttendeesCsv

java.lang.Object
org.exoplatform.agenda.util.AttendeesCsv

public final class AttendeesCsv extends Object
Writes the participant list of an event as a CSV file (RFC 4180): UTF-8 with a byte order mark, so that a spreadsheet reads its accents, a comma between cells and CRLF after each line, every cell quoted.

Names, space names and guest addresses are typed by users: a cell starting with a character a spreadsheet reads as the start of a formula gets a single quote before it, so that no cell of the file is ever evaluated.

  • Field Details

    • BYTE_ORDER_MARK

      public static final String BYTE_ORDER_MARK
      Starts the file, so that a spreadsheet reads it as UTF-8.
      See Also:
    • LINE_SEPARATOR

      public static final String LINE_SEPARATOR
      Ends each line of the file.
      See Also:
    • FILE_NAME_SUFFIX

      public static final String FILE_NAME_SUFFIX
      Ends the name of the file, after the event's title.
      See Also:
  • Method Details

    • write

      public static String write(List<List<String>> lines)
      Parameters:
      lines - the lines of the file, the header first, each a list of cells
      Returns:
      the file's text, its byte order mark included
    • cell

      public static String cell(String value)
      Parameters:
      value - the text of a cell, null for an empty one
      Returns:
      the cell as written in the file: neutralised when it would start a formula, then quoted, its quotes doubled
    • fileName

      public static String fileName(LocalDate exportDay, String title)
      Parameters:
      exportDay - the day of the export
      title - the event's title
      Returns:
      YYYYMMDD_<title>_participants list.csv, the title's characters a file name may not hold, and its control characters, replaced with an underscore