aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-12-01 15:06:08 +0300
committerGravatar Vitaly Takmazov2016-12-01 15:06:08 +0300
commita19d224e5de6a067cc559a23cf6b4afdef060d56 (patch)
tree8198e97a3bd7354da2973ad647d99a110cfa69b5 /juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java
parent3d7f60c1c0b48dad2f58bffe3352d1c5c1b93f00 (diff)
juick-api: Notifications controller from perl, refactoring
Diffstat (limited to 'juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java')
-rw-r--r--juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java36
1 files changed, 32 insertions, 4 deletions
diff --git a/juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java b/juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java
index b11f0a79..aca48a19 100644
--- a/juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java
@@ -24,7 +24,7 @@ public class PushQueriesServiceImpl extends BaseJdbcService implements PushQueri
}
@Override
- public List<String> getAndroidRegID(final int uid) {
+ public List<String> getGCMRegID(final int uid) {
return getJdbcTemplate().queryForList(
"SELECT regid FROM android WHERE user_id=?",
String.class,
@@ -32,7 +32,7 @@ public class PushQueriesServiceImpl extends BaseJdbcService implements PushQueri
}
@Override
- public List<String> getAndroidTokens(final Collection<Integer> uids) {
+ public List<String> getGCMTokens(final Collection<Integer> uids) {
if (CollectionUtils.isEmpty(uids))
return Collections.emptyList();
@@ -43,7 +43,18 @@ public class PushQueriesServiceImpl extends BaseJdbcService implements PushQueri
}
@Override
- public List<String> getWinPhoneURL(final int uid) {
+ public boolean addGCMToken(Integer uid, String token) {
+ return getJdbcTemplate().update("INSERT IGNORE INTO android(user_id,regid) VALUES (?, ?)",
+ uid, token) > 0;
+ }
+
+ @Override
+ public boolean deleteGCMToken(String token) {
+ return getJdbcTemplate().update("DELETE FROM android WHERE regid=?", token) > 0;
+ }
+
+ @Override
+ public List<String> getMPNSURL(final int uid) {
return getJdbcTemplate().queryForList(
"SELECT url FROM winphone WHERE user_id=?",
String.class,
@@ -51,7 +62,7 @@ public class PushQueriesServiceImpl extends BaseJdbcService implements PushQueri
}
@Override
- public List<String> getWindowsTokens(final Collection<Integer> uids) {
+ public List<String> getMPNSTokens(final Collection<Integer> uids) {
if (CollectionUtils.isEmpty(uids))
return Collections.emptyList();
@@ -62,6 +73,17 @@ public class PushQueriesServiceImpl extends BaseJdbcService implements PushQueri
}
@Override
+ public boolean addMPNSToken(Integer uid, String token) {
+ return getJdbcTemplate().update("INSERT IGNORE INTO winphone(user_id,url) VALUES (?, ?)",
+ uid, token) > 0;
+ }
+
+ @Override
+ public boolean deleteMPNSToken(String token) {
+ return getJdbcTemplate().update("DELETE FROM winphone WHERE url=?", token) > 0;
+ }
+
+ @Override
public List<String> getAPNSToken(final int uid) {
return getJdbcTemplate().queryForList(
"SELECT token from ios WHERE user_id=?",
@@ -84,4 +106,10 @@ public class PushQueriesServiceImpl extends BaseJdbcService implements PushQueri
new MapSqlParameterSource("ids", uids),
String.class);
}
+
+ @Override
+ public boolean addAPNSToken(Integer uid, String token) {
+ return getJdbcTemplate().update("INSERT IGNORE INTO ios(user_id,token) VALUES (?, ?)",
+ uid, token) > 0;
+ }
}