aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server/MessagesQueries.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-12-01 13:56:53 +0300
committerGravatar Vitaly Takmazov2016-12-01 13:56:53 +0300
commit3d7f60c1c0b48dad2f58bffe3352d1c5c1b93f00 (patch)
treeab311d5d6102b2c76c03b266fc1b794108cba0fc /juick-server/src/main/java/com/juick/server/MessagesQueries.java
parent92d6700919e87c81db4a42a4b286257f62566cbf (diff)
juick-api: Tags controller from perl, refactoring
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/MessagesQueries.java')
-rw-r--r--juick-server/src/main/java/com/juick/server/MessagesQueries.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/juick-server/src/main/java/com/juick/server/MessagesQueries.java b/juick-server/src/main/java/com/juick/server/MessagesQueries.java
index fd1e5b51..36d311df 100644
--- a/juick-server/src/main/java/com/juick/server/MessagesQueries.java
+++ b/juick-server/src/main/java/com/juick/server/MessagesQueries.java
@@ -21,6 +21,7 @@ import com.juick.Message;
import com.juick.Tag;
import com.juick.User;
import com.juick.server.helpers.PrivacyOpts;
+import com.juick.server.helpers.TagStats;
import com.juick.util.MessageUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.springframework.dao.EmptyResultDataAccessException;
@@ -308,16 +309,18 @@ public class MessagesQueries {
}
}
- public static List<com.juick.Tag> getMessageTags(JdbcTemplate sql, int mid) {
+ public static List<TagStats> getMessageTags(JdbcTemplate sql, int mid) {
return sql.query("SELECT tags.tag_id,synonym_id,name,stat_messages FROM tags " +
"INNER JOIN messages_tags ON (messages_tags.message_id=? AND messages_tags.tag_id=tags.tag_id)",
- new Object[]{mid}, (rs, num) -> {
+ (rs, num) -> {
com.juick.Tag t = new com.juick.Tag(StringEscapeUtils.unescapeHtml4(rs.getString(3)));
t.TID = rs.getInt(1);
t.SynonymID = rs.getInt(2);
- t.UsageCnt = rs.getInt(4);
- return t;
- });
+ TagStats s = new TagStats();
+ s.setTag(t);
+ s.setUsageCount(rs.getInt(4));
+ return s;
+ }, mid);
}
public static List<Integer> getMessageTagsIDs(JdbcTemplate sql, int mid) {