aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server/PushQueries.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-11-16 14:30:50 +0300
committerGravatar Vitaly Takmazov2016-11-16 16:21:53 +0300
commitffb24e0d469aaafa35ad5f460a7bdf771382f0ff (patch)
tree0d8fc9114b916f9058cccb01fcf8281a0a209284 /juick-server/src/main/java/com/juick/server/PushQueries.java
parente8faf851327a12f28ae664a6f7db6c844d0ba9bf (diff)
server-core -> juick-server
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/PushQueries.java')
-rw-r--r--juick-server/src/main/java/com/juick/server/PushQueries.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/juick-server/src/main/java/com/juick/server/PushQueries.java b/juick-server/src/main/java/com/juick/server/PushQueries.java
new file mode 100644
index 00000000..904b3c0d
--- /dev/null
+++ b/juick-server/src/main/java/com/juick/server/PushQueries.java
@@ -0,0 +1,44 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.juick.server;
+
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.util.StringUtils;
+
+import java.util.List;
+
+/**
+ *
+ * @author ugnich
+ */
+public class PushQueries {
+
+ public static List<String> getAndroidRegID(JdbcTemplate sql, int uid) {
+ return sql.queryForList("SELECT regid FROM android WHERE user_id=?", String.class, uid);
+ }
+
+ public static List<String> getAndroidTokens(JdbcTemplate sql, List<Integer> uids) {
+ return sql.queryForList("SELECT regid FROM android INNER JOIN users " +
+ "ON (users.id=android.user_id) WHERE users.id IN (" + StringUtils.collectionToCommaDelimitedString(uids) + ")", String.class);
+ }
+
+ public static List<String> getWinPhoneURL(JdbcTemplate sql, int uid) {
+ return sql.queryForList("SELECT url FROM winphone WHERE user_id=?", String.class, uid);
+ }
+
+ public static List<String> getWindowsTokens(JdbcTemplate sql, List<Integer> uids) {
+ return sql.queryForList("SELECT url FROM winphone INNER JOIN users " +
+ "ON (users.id=winphone.user_id) WHERE users.id IN (" + StringUtils.collectionToCommaDelimitedString(uids) + ")", String.class);
+ }
+
+ public static List<String> getAPNSToken(JdbcTemplate sql, int uid) {
+ return sql.queryForList("SELECT token from ios WHERE user_id=?", String.class, uid);
+ }
+
+ public static List<String> getAPNSTokens(JdbcTemplate sql, List<Integer> uids) {
+ return sql.queryForList("SELECT token FROM ios INNER JOIN users " +
+ "ON (users.id=ios.user_id) WHERE users.id IN (" + StringUtils.collectionToCommaDelimitedString(uids) + ")", String.class);
+ }
+}