-
Notifications
You must be signed in to change notification settings - Fork 12
/
SoBoticsPostPrinter.java
48 lines (35 loc) · 1.7 KB
/
SoBoticsPostPrinter.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package in.bhargavrao.stackoverflow.natty.printers;
import in.bhargavrao.stackoverflow.natty.model.Post;
import in.bhargavrao.stackoverflow.natty.model.PostReport;
import in.bhargavrao.stackoverflow.natty.services.FMSService;
import in.bhargavrao.stackoverflow.natty.utils.PostUtils;
import in.bhargavrao.stackoverflow.natty.utils.PrintUtils;
import in.bhargavrao.stackoverflow.natty.utils.SentinelUtils;
import java.util.List;
/**
* Created by bhargav.h on 20-Oct-16.
*/
public class SoBoticsPostPrinter implements PostPrinter {
public final long roomId = 111347;
@Override
public String print(PostReport report) {
Post np =report.getPost();
long SentinelId = PostUtils.addSentinel(report, "stackoverflow", "stackoverflow.com");
String description;
if(SentinelId==-1){
description = ("[ [Natty](" + PrintUtils.printStackAppsPost() + ") | [FMS](" + new FMSService().storeReport(report) + ") ]");
}
else {
description = ("[ [Natty](" + PrintUtils.printStackAppsPost() + ") | [Sentinel](" + SentinelUtils.getSentinelMainUrl("stackoverflow") + "/posts/" + SentinelId + ") ]");
}
in.bhargavrao.stackoverflow.natty.utils.PostPrinter postPrinter = new in.bhargavrao.stackoverflow.natty.utils.PostPrinter(np,description).addMainTag().addQuesionLink().addBodyLength().addReputation();
Double naaValue = report.getNaaValue();
List<String> caughtFilters = report.getCaughtFor();
for(String filter: caughtFilters){
postPrinter.addMessage(" **"+filter+"**; ");
}
postPrinter.addFirstLine();
postPrinter.addMessage(" **"+naaValue+"**;");
return postPrinter.print();
}
}