@Override public String getCsvString(LocalDate date) { Status status = creationDate.isEqual(date) ? Status.Creation : Status.Editing; int articleCountForDate = 0; final StringBuilder articleStringsBuilder = new StringBuilder(); for (ArticleOutput articleOutput : articleOutputList) { String articleCsvString = articleOutput.getCsvString(date); if (!articleCsvString.isEmpty()) { articleStringsBuilder.append(articleCsvString); articleCountForDate++; } } final StringBuilder csvStringBuilder = new StringBuilder(); if (status.equals(Status.Creation) || (status.equals(Status.Editing) && articleCountForDate != 0)) { csvStringBuilder.append("ID,Platform,TLD,Status,Article Amount:"); csvStringBuilder.append(System.lineSeparator()); csvStringBuilder.append(id).append(","); csvStringBuilder.append(platform).append(","); csvStringBuilder.append(tld).append(","); csvStringBuilder.append(status).append(","); csvStringBuilder.append(articleCountForDate); csvStringBuilder.append(System.lineSeparator()); csvStringBuilder.append(articleStringsBuilder.toString()); } return csvStringBuilder.toString(); }
@Override public String getCsvString(LocalDate date) { Status status = creationDate.isEqual(date) ? Status.Creation : Status.Editing; int articleCountForDate = 0; final StringBuilder builder = new StringBuilder(); if (status.equals(Status.Creation) || (status.equals(Status.Editing) && articleCountForDate != 0)) { builder.append("ID,Submission Site,"); for (int i = 1; i <= anchorList.size(); i++) { builder.append(",ANCHOR ").append(i); } for (int i = 1; i <= linkList.size(); i++) { builder.append(",LINK ").append(i); } builder.append(System.lineSeparator()); builder.append(id).append(","); builder.append(site).append(","); builder.append(id).append(","); for (int i = 0; i < anchorList.size(); i++) { if (i < anchorList.size()) { builder.append(anchorList.get(i)); } builder.append(","); } for (int i = 0; i < linkList.size(); i++) { if (i < linkList.size()) { builder.append(linkList.get(i)); } if (i != linkList.size() - 1) { builder.append(","); } } builder.append(System.lineSeparator()); } return builder.toString(); }