diff options
author | 2016-07-07 15:13:47 +0300 | |
---|---|---|
committer | 2016-07-07 15:13:47 +0300 | |
commit | e5c8298beee5dde90ca98cc4707faac4bf0e2f0c (patch) | |
tree | 10178a0103ae8ac17849e56914b87b0ee681d0ba /src/main/java/com/juick/server/PushQueries.java | |
parent | d85424021a63c1519e18bd6518ad3424de61fb9f (diff) |
reorganize project
Diffstat (limited to 'src/main/java/com/juick/server/PushQueries.java')
-rw-r--r-- | src/main/java/com/juick/server/PushQueries.java | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/src/main/java/com/juick/server/PushQueries.java b/src/main/java/com/juick/server/PushQueries.java deleted file mode 100644 index 54528993..00000000 --- a/src/main/java/com/juick/server/PushQueries.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package com.juick.server; - -import org.springframework.dao.EmptyResultDataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.util.StringUtils; - -import java.util.List; -import java.util.Optional; - -/** - * - * @author ugnich - */ -public class PushQueries { - - public static Optional<String> getAndroidRegID(JdbcTemplate sql, int uid) { - try { - return Optional.of(sql.queryForObject("SELECT regid FROM android WHERE user_id=?", String.class, uid)); - } catch (EmptyResultDataAccessException e) { - return Optional.empty(); - } - - } - - public static List<String> getAndroidSubscribers(JdbcTemplate sql, int uid) { - return sql.queryForList("SELECT regid FROM android INNER JOIN subscr_users " + - "ON (subscr_users.user_id=? AND android.user_id=subscr_users.suser_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 Optional<String> getWinPhoneURL(JdbcTemplate sql, int uid) { - try { - return Optional.of(sql.queryForObject("SELECT url FROM winphone WHERE user_id=?", String.class, uid)); - } catch (EmptyResultDataAccessException e) { - return Optional.empty(); - } - } - - public static List<String> getWinPhoneSubscribers(JdbcTemplate sql, int uid) { - return sql.queryForList("SELECT url FROM winphone INNER JOIN subscr_users " + - "ON (subscr_users.user_id=? AND winphone.user_id=subscr_users.suser_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 Optional<String> getAPNSToken(JdbcTemplate sql, int uid) { - try { - return Optional.of(sql.queryForObject("SELECT token from ios WHERE user_id=?", String.class, uid)); - } catch (EmptyResultDataAccessException e) { - return Optional.empty(); - } - } - - public static List<String> getAPNSSubscribers(JdbcTemplate sql, int uid) { - return sql.queryForList("SELECT token FROM ios INNER JOIN subscr_users " + - "ON (subscr_users.user_id=? AND ios.user_id=subscr_users.suser_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); - } - -} |