private void writeHeader(CSVWriter writer, EventEx event) { List<String> headers = new ArrayList<String>(); headers.add("チケット名"); headers.add("順番"); headers.add("名前"); headers.add("予約状況"); headers.add("コメント"); headers.add("登録日時"); headers.add("出欠状況"); if (event.getEnquetes() != null && !event.getEnquetes().isEmpty()) { for (EnqueteQuestion question : event.getEnquetes()) headers.add(question.getText()); } writer.writeNext(headers.toArray(new String[0])); }
private void writeTicket( CSVWriter writer, EventEx event, EventTicket ticket, EventTicketHolderList holderList, int ticketIndex, Map<String, List<String>> userTicketInfoMap) { int order = 0; for (UserTicketEx userTicket : holderList.getEnrolledParticipations()) { List<String> body = new ArrayList<String>(); body.add(ticket.getName()); body.add(String.valueOf(++order)); body.add(userTicket.getUser().getScreenName()); body.add(userTicket.getStatus().toHumanReadableString(false)); body.add(userTicket.getComment()); body.add(userTicket.getAppliedAt().toHumanReadableFormat()); body.add(userTicket.getAttendanceStatus().toHumanReadableString()); if (event.getEnquetes() != null && !event.getEnquetes().isEmpty()) { for (EnqueteQuestion question : event.getEnquetes()) { List<String> values = userTicket.getEnqueteAnswers().get(question.getId()); body.add(values != null ? StringUtils.join(values.iterator(), ',') : ""); } } writer.writeNext(body.toArray(new String[0])); } for (UserTicketEx userTicket : holderList.getSpareParticipations()) { List<String> body = new ArrayList<String>(); body.add(ticket.getName()); body.add(String.valueOf(++order)); body.add(userTicket.getUser().getScreenName()); body.add(userTicket.getStatus().toHumanReadableString(false)); body.add(userTicket.getComment()); body.add(userTicket.getAppliedAt().toHumanReadableFormat()); body.add(userTicket.getAttendanceStatus().toHumanReadableString()); if (event.getEnquetes() != null && !event.getEnquetes().isEmpty()) { for (EnqueteQuestion question : event.getEnquetes()) { List<String> values = userTicket.getEnqueteAnswers().get(question.getId()); body.add(values != null ? StringUtils.join(values.iterator(), ',') : ""); } } writer.writeNext(body.toArray(new String[0])); } }