1 /***
2 *
3 */
4 package hu.elte.tribus.services;
5
6 import hu.elte.tribus.interfaces.FaqExporter;
7 import hu.elte.tribus.model.Conversation;
8 import hu.elte.tribus.model.Item;
9 import hu.elte.tribus.model.Topic;
10
11 import java.io.OutputStream;
12 import java.io.PrintWriter;
13
14 /***
15 * @author kocka
16 *
17 */
18 public class AptFaqExporter implements FaqExporter {
19
20 private final static String separatorLines = "------";
21
22 public void exportConversation(Conversation conversation, OutputStream output) {
23 PrintWriter writer = new PrintWriter(output);
24 writer.write(separatorLines);
25 writer.write(conversation.getTopic().getName());
26 writer.write(separatorLines);
27 writer.write(conversation.getUser().getUsername());
28 writer.write(separatorLines);
29
30 writer.write(conversation.getStartdate().toString());
31 writer.write("\n");
32 for(Item item : conversation.getItems()) {
33 writer.write(item.getQuestion());
34 writer.write("\n");
35 writer.write(item.getQa().getAnswer());
36 writer.write("\n\n");
37 }
38
39 writer.flush();
40 }
41
42 public void exportTopic(Topic topic, OutputStream output) {
43
44 }
45
46 }