64 |
return response; |
return response; |
65 |
} |
} |
66 |
|
|
67 |
private void loadComments(String appId, MarketSession session, String locale, ArrayList<CommentBean> commentBeans) { |
private void loadComments(String appId, MarketSession session, ArrayList<CommentBean> commentBeans) { |
68 |
CommentCallback commentsCb = new CommentCallback(); |
CommentCallback commentsCb = new CommentCallback(); |
69 |
commentsCb.setList( commentBeans ); |
commentsCb.setList( commentBeans ); |
70 |
|
|
71 |
commentsCb.setLocale( locale ); |
session.setLocale( Locale.ROOT ); |
72 |
session.setLocale( new Locale(locale) ); |
|
73 |
|
|
74 |
|
|
75 |
int start = 0; |
int start = 0; |
78 |
if (start > 0) |
if (start > 0) |
79 |
count = Math.min(10, commentsCb.getEntryCount() ); |
count = Math.min(10, commentsCb.getEntryCount() ); |
80 |
|
|
81 |
//log.warning("count=" + count + " start=" + start + " " + locale); |
//log.warning("count=" + count + " start=" + start ); |
82 |
CommentsRequest commentsRequest = CommentsRequest.newBuilder() |
CommentsRequest commentsRequest = CommentsRequest.newBuilder() |
83 |
.setAppId(appId) |
.setAppId(appId) |
84 |
.setStartIndex(start) |
.setStartIndex(start) |
89 |
session.flush(); |
session.flush(); |
90 |
start +=10; |
start +=10; |
91 |
|
|
92 |
if (start >= 20) |
if (start >= 50) |
93 |
break; //emergency brake |
break; //emergency brake |
94 |
|
|
95 |
} while ( start < commentsCb.getEntryCount() ); |
} while ( start < commentsCb.getEntryCount() ); |
125 |
|
|
126 |
if (appId != null) { |
if (appId != null) { |
127 |
|
|
128 |
loadComments(appId, session, "da", commentBeans); |
loadComments(appId, session, commentBeans); |
|
loadComments(appId, session, "en", commentBeans); |
|
|
|
|
|
Collections.sort(commentBeans); |
|
129 |
|
|
130 |
sb.append("-----------------------------------------------------------------\n"); |
sb.append("-----------------------------------------------------------------\n"); |
131 |
for (CommentBean c : commentBeans) { |
for (CommentBean c : commentBeans) { |
132 |
sb.append("User: " + c.author + " (" + c.locale + ")\n"); |
sb.append("User: " + c.author + "\n"); |
133 |
sb.append("Rating: " + c.rating + "\n"); |
sb.append("Rating: " + c.rating + "\n"); |
134 |
sb.append("Time: " + new Date(c.time).toString() + "\n"); |
sb.append("Time: " + new Date(c.time).toString() + "\n"); |
135 |
sb.append( c.text + "\n"); |
sb.append( c.text + "\n"); |