- String title = "";
- if (meta != null && meta.getTitle() != null) {
- title = meta.getTitle();
- }
-
- String tags = "";
- if (meta != null && meta.getTags() != null) {
- for (String tag : meta.getTags()) {
- if (!tags.isEmpty()) {
- tags += ", ";
- }
- tags += tag;
- }
- }
-
- String resume = "";
- if (meta != null && meta.getResume() != null) {
- for (Paragraph para : meta.getResume()) {
- resume += "\n\t";
- resume += para.toString().substring(0,
- Math.min(para.toString().length(), 120));
- }
- resume += "\n";
- }
-
- String cover = (meta == null || meta.getCover() == null) ? "none"
- : meta.getCover().getWidth() + "x"
- + meta.getCover().getHeight();
- return String.format(
- "Title: [%s]\nAuthor: [%s]\nDate: [%s]\nTags: [%s]\n"
- + "Resume: [%s]\nCover: [%s]", title, meta == null ? ""
- : meta.getAuthor(), meta == null ? "" : meta.getDate(),
- tags, resume, cover);