diff options
Diffstat (limited to 'server-core/src/main/java/com/juick/service')
6 files changed, 69 insertions, 69 deletions
diff --git a/server-core/src/main/java/com/juick/service/MessagesServiceImpl.java b/server-core/src/main/java/com/juick/service/MessagesServiceImpl.java index dfbc4ade..bb030ed4 100644 --- a/server-core/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/server-core/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -43,19 +43,19 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ @Override public Message mapRow(ResultSet rs, int rowNum) throws SQLException { Message msg = new Message(); - msg.setMID(rs.getInt(1)); - msg.setRID(rs.getInt(2)); - msg.ReplyTo = rs.getInt(3); + msg.setMid(rs.getInt(1)); + msg.setRid(rs.getInt(2)); + msg.setReplyto(rs.getInt(3)); User user = new User(); - user.setUID(rs.getInt(4)); - user.setUName(rs.getString(5)); - user.Banned = rs.getBoolean(6); + user.setUid(rs.getInt(4)); + user.setName(rs.getString(5)); + user.setBanned(rs.getBoolean(6)); msg.setUser(user); msg.TimeAgo = rs.getInt(7); msg.setDate(rs.getTimestamp(8)); msg.ReadOnly = rs.getBoolean(9); - msg.Privacy = rs.getInt(10); - msg.FriendsOnly = msg.Privacy < 0; + msg.setPrivacy(rs.getInt(10)); + msg.FriendsOnly = msg.getPrivacy() < 0; msg.Replies = rs.getInt(11); msg.AttachmentType = rs.getString(12); if (rs.getDouble(13) != 0) { @@ -68,7 +68,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ // parse tags string String tagsStr = rs.getString(18); if (tagsStr != null) { - Arrays.stream(tagsStr.split(" ")).forEach(t -> msg.Tags.add(new Tag(t))); + Arrays.stream(tagsStr.split(" ")).forEach(t -> msg.getTags().add(new Tag(t))); } msg.RepliesBy = rs.getString(19); msg.setText(rs.getString(20)); @@ -305,12 +305,12 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ + "WHERE replies.message_id=? AND replies.reply_id=?", (rs, num) -> { Message msg = new Message(); - msg.setMID(mid); - msg.setRID(rid); + msg.setMid(mid); + msg.setRid(rid); msg.setUser(new User()); - msg.getUser().setUID(rs.getInt(1)); - msg.getUser().setUName(rs.getString(2)); - msg.ReplyTo = rs.getInt(3); + msg.getUser().setUid(rs.getInt(1)); + msg.getUser().setName(rs.getString(2)); + msg.setReplyto(rs.getInt(3)); msg.setDate(rs.getTimestamp(4)); msg.AttachmentType = rs.getString(5); msg.setText(rs.getString(6)); @@ -335,8 +335,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ + "ON messages.user_id=users.id WHERE messages.message_id=?", new Object[]{mid}, (rs, num) -> { User res = new com.juick.User(); - res.setUID(rs.getInt(1)); - res.setUName(rs.getString(2)); + res.setUid(rs.getInt(1)); + res.setName(rs.getString(2)); return res; }); } catch (EmptyResultDataAccessException e) { diff --git a/server-core/src/main/java/com/juick/service/PMQueriesServiceImpl.java b/server-core/src/main/java/com/juick/service/PMQueriesServiceImpl.java index 34a07682..5c28c2ba 100644 --- a/server-core/src/main/java/com/juick/service/PMQueriesServiceImpl.java +++ b/server-core/src/main/java/com/juick/service/PMQueriesServiceImpl.java @@ -87,8 +87,8 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe + "ORDER BY pm_streams.unread DESC, pm_streams.lastmessage DESC LIMIT " + cnt, (rs, rowNum) -> { com.juick.User u = new com.juick.User(); - u.setUID(rs.getInt(1)); - u.setUName(rs.getString(2)); + u.setUid(rs.getInt(1)); + u.setName(rs.getString(2)); u.setUnreadCount(rs.getInt(3)); return u; }, @@ -106,7 +106,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe com.juick.Message msg = new com.juick.Message(); int uuid = rs.getInt(1); msg.setUser(new User()); - msg.getUser().setUID(uuid); + msg.getUser().setUid(uuid); msg.setText(rs.getString(2)); msg.setDate(rs.getTimestamp(3)); return msg; @@ -133,8 +133,8 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe (rs, num) -> { com.juick.Message msg = new com.juick.Message(); msg.setUser(new User()); - msg.getUser().setUID(rs.getInt(1)); - msg.getUser().setUName(rs.getString(2)); + msg.getUser().setUid(rs.getInt(1)); + msg.getUser().setName(rs.getString(2)); msg.setText(rs.getString(3)); msg.TimeAgo = rs.getInt(4); msg.setDate(rs.getTimestamp(5)); @@ -153,8 +153,8 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe (rs, num) -> { com.juick.Message msg = new com.juick.Message(); msg.setUser(new User()); - msg.getUser().setUID(rs.getInt(1)); - msg.getUser().setUName(rs.getString(2)); + msg.getUser().setUid(rs.getInt(1)); + msg.getUser().setName(rs.getString(2)); msg.setText(rs.getString(3)); msg.TimeAgo = rs.getInt(4); msg.setDate(rs.getTimestamp(5)); diff --git a/server-core/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java b/server-core/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java index 18c789ec..7dac4073 100644 --- a/server-core/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java +++ b/server-core/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java @@ -24,15 +24,15 @@ public class PrivacyQueriesServiceImpl extends BaseJdbcService implements Privac public PrivacyResult blacklistUser(final User user, final User target) { int result = getJdbcTemplate().update( "DELETE FROM bl_users WHERE user_id=? AND bl_user_id=?", - user.getUID(), - target.getUID()); + user.getUid(), + target.getUid()); if (result > 0) { return PrivacyResult.Removed; } else { getJdbcTemplate().update( "INSERT INTO bl_users(user_id,bl_user_id) VALUES (?,?)", - user.getUID(), - target.getUID()); + user.getUid(), + target.getUid()); return PrivacyResult.Added; } } @@ -41,14 +41,14 @@ public class PrivacyQueriesServiceImpl extends BaseJdbcService implements Privac public PrivacyResult blacklistTag(final User user, final Tag tag) { int result = getJdbcTemplate().update( "DELETE FROM bl_tags WHERE user_id=? AND tag_id=?", - user.getUID(), + user.getUid(), tag.TID); if (result > 0) { return PrivacyResult.Removed; } else { getJdbcTemplate().update( "INSERT INTO bl_tags(user_id,tag_id) VALUES (?,?)", - user.getUID(), + user.getUid(), tag.TID); return PrivacyResult.Added; } diff --git a/server-core/src/main/java/com/juick/service/ShowQueriesServiceImpl.java b/server-core/src/main/java/com/juick/service/ShowQueriesServiceImpl.java index a6504274..2ddfeb84 100644 --- a/server-core/src/main/java/com/juick/service/ShowQueriesServiceImpl.java +++ b/server-core/src/main/java/com/juick/service/ShowQueriesServiceImpl.java @@ -31,10 +31,10 @@ public class ShowQueriesServiceImpl extends BaseJdbcService implements ShowQueri "AND subscr_users.user_id!=? AND users.lastmessage>UNIX_TIMESTAMP()-259200 " + "GROUP BY subscr_users.user_id ORDER BY count(*) DESC LIMIT 10", String.class, - forUser.getUID(), - forUser.getUID(), - forUser.getUID(), - forUser.getUID()); + forUser.getUid(), + forUser.getUid(), + forUser.getUid(), + forUser.getUid()); } @Override diff --git a/server-core/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/server-core/src/main/java/com/juick/service/SubscriptionServiceImpl.java index 2bf05796..f6ecb658 100644 --- a/server-core/src/main/java/com/juick/service/SubscriptionServiceImpl.java +++ b/server-core/src/main/java/com/juick/service/SubscriptionServiceImpl.java @@ -61,7 +61,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip List<User> userids = userService.getUserReaders(uid); Set<Integer> set = new HashSet<>(); - set.addAll(userids.stream().map(User::getUID).collect(Collectors.toList())); + set.addAll(userids.stream().map(User::getUid).collect(Collectors.toList())); List<Integer> tags = messagesService.getMessageTagsIDs(mid); if (tags.size() > 0) { List<Integer> tagUsers = getJdbcTemplate().queryForList( @@ -70,7 +70,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip " AND suser_id NOT IN (SELECT user_id FROM bl_users WHERE bl_user_id=?)", Integer.class, uid, - author.getUID()); + author.getUid()); set.addAll(tagUsers); } return userService.getUsersByID(new ArrayList<>(set)); @@ -134,7 +134,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip public boolean subscribeUser(final User user, final User toUser) { return getJdbcTemplate().update( "INSERT IGNORE INTO subscr_users(user_id,suser_id) VALUES (?,?)", - toUser.getUID(), user.getUID()) == 1; + toUser.getUid(), user.getUid()) == 1; } @Transactional @@ -142,7 +142,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip public boolean unSubscribeUser(final User user, final User fromUser) { return getJdbcTemplate().update( "DELETE FROM subscr_users WHERE suser_id=? AND user_id=?", - user.getUID(), fromUser.getUID()) > 0; + user.getUid(), fromUser.getUid()) > 0; } @Transactional @@ -150,7 +150,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip public boolean subscribeTag(final User user, final Tag toTag) { return getJdbcTemplate().update( "INSERT IGNORE INTO subscr_tags(tag_id,suser_id) VALUES (?,?)", - toTag.TID, user.getUID()) == 1; + toTag.TID, user.getUid()) == 1; } @Transactional @@ -158,7 +158,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip public boolean unSubscribeTag(final User user, final Tag toTag) { return getJdbcTemplate().update( "DELETE FROM subscr_tags WHERE tag_id=? AND suser_id=?", - toTag.TID, user.getUID()) > 0; + toTag.TID, user.getUid()) > 0; } @Transactional(readOnly = true) @@ -174,7 +174,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip options.setRecommendationsEnabled(rs.getInt(3) > 0); return options; }, - user.getUID()); + user.getUid()); } catch (EmptyResultDataAccessException e) { return new NotifyOpts(); } @@ -185,12 +185,12 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip public boolean setNotifyOptions(final User user, final NotifyOpts options) { return getJdbcTemplate().update( "UPDATE useroptions SET jnotify=? WHERE user_id=?", options.isRepliesEnabled() ? 1 : 0, - user.getUID()) > 0 && + user.getUid()) > 0 && getJdbcTemplate().update( "UPDATE useroptions SET subscr_notify=? WHERE user_id=?", options.isSubscriptionsEnabled() ? 1 : 0, - user.getUID()) > 0 && + user.getUid()) > 0 && getJdbcTemplate().update( "UPDATE useroptions SET recommendations=? WHERE user_id=?", options.isRecommendationsEnabled() ? 1 : 0, - user.getUID()) > 0; + user.getUid()) > 0; } } diff --git a/server-core/src/main/java/com/juick/service/UserServiceImpl.java b/server-core/src/main/java/com/juick/service/UserServiceImpl.java index b681e3c8..63785cff 100644 --- a/server-core/src/main/java/com/juick/service/UserServiceImpl.java +++ b/server-core/src/main/java/com/juick/service/UserServiceImpl.java @@ -32,9 +32,9 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { @Override public User mapRow(ResultSet rs, int rowNum) throws SQLException { User user = new User(); - user.setUID(rs.getInt(1)); - user.setUName(rs.getString(2)); - user.Banned = rs.getBoolean(3); + user.setUid(rs.getInt(1)); + user.setName(rs.getString(2)); + user.setBanned(rs.getBoolean(3)); return user; } } @@ -172,8 +172,8 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { + "WHERE jids.jid IN (\"" + StringUtils.arrayToDelimitedString(jids.toArray(), "\",\"") + "\")", (rs, rowNum) -> { com.juick.User user = new com.juick.User(); - user.setUID(rs.getInt(1)); - user.setUName(rs.getString(2)); + user.setUid(rs.getInt(1)); + user.setName(rs.getString(2)); user.setJID(rs.getString(3)); return user; }); @@ -260,7 +260,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { if (realPassword.equals(password)) { User user = getUserByName(username); if (user != null) { - return user.getUID(); + return user.getUid(); } else { return -1; } @@ -275,7 +275,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { @Transactional @Override public boolean updatePassword(final User user, final String newPassword) { - return user.getUID() > 0 && getJdbcTemplate().update("UPDATE users SET passw=? WHERE id=?", newPassword, user.getUID()) > 0; + return user.getUid() > 0 && getJdbcTemplate().update("UPDATE users SET passw=? WHERE id=?", newPassword, user.getUid()) > 0; } @Transactional @@ -284,7 +284,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { String newHash = UserUtils.generateHash(16); if (getJdbcTemplate().update( "INSERT INTO mail(user_id,hash) VALUES (?,?) ON DUPLICATE KEY UPDATE hash=?", - user.getUID(), + user.getUid(), newHash, newHash) > 0) { return newHash; @@ -320,7 +320,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { info.setUrl(rs.getString(3)); info.setDescription(rs.getString(4)); return info; - }), user.getUID()); + }), user.getUid()); } catch (EmptyResultDataAccessException e) { return new UserInfo(); } @@ -332,7 +332,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { return getJdbcTemplate().update( "INSERT INTO usersinfo(user_id,fullname,country,url,descr) VALUES (?,?,?,?,?) " + "ON DUPLICATE KEY UPDATE fullname=?,country=?,url=?,descr=?", - user.getUID(), + user.getUid(), info.getFullName(), info.getCountry(), info.getUrl(), @@ -435,8 +435,8 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { "ON subscr_users.user_id=users.id ORDER BY cnt LIMIT ?", (rs, num) -> { com.juick.User u = new com.juick.User(); - u.setUID(rs.getInt(1)); - u.setUName(rs.getString(2)); + u.setUid(rs.getInt(1)); + u.setName(rs.getString(2)); return u; }, uid, @@ -452,8 +452,8 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { "WHERE subscr_users.user_id=? ORDER BY users.nick", (rs, num) -> { com.juick.User u = new com.juick.User(); - u.setUID(rs.getInt(1)); - u.setUName(rs.getString(2)); + u.setUid(rs.getInt(1)); + u.setName(rs.getString(2)); return u; }, uid); @@ -469,8 +469,8 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { "ORDER BY users.nick", (rs, num) -> { com.juick.User u = new com.juick.User(); - u.setUID(rs.getInt(1)); - u.setUName(rs.getString(2)); + u.setUid(rs.getInt(1)); + u.setName(rs.getString(2)); return u; }, uid, @@ -484,8 +484,8 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { "ON(bl_users.bl_user_id=users.id) WHERE bl_users.user_id=? ORDER BY users.nick", (rs, num) -> { com.juick.User u = new com.juick.User(); - u.setUID(rs.getInt(1)); - u.setUName(rs.getString(2)); + u.setUid(rs.getInt(1)); + u.setName(rs.getString(2)); return u; }, uid); } @@ -497,9 +497,9 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { if (getJdbcTemplate().update("INSERT INTO twitter(user_id,access_token,access_token_secret,uname) " + "VALUES (?,?,?,?)" + " ON DUPLICATE KEY UPDATE access_token=?,access_token_secret=?,uname=?", - user.getUID(), accessToken, accessTokenSecret, screenName, accessToken, accessTokenSecret, screenName) > 0) { + user.getUid(), accessToken, accessTokenSecret, screenName, accessToken, accessTokenSecret, screenName) > 0) { return getJdbcTemplate().update("INSERT INTO subscr_users(user_id,suser_id,jid) " + - "VALUES (?,1741,'juick\\@twitter.juick.com')", user.getUID()) > 0; + "VALUES (?,1741,'juick\\@twitter.juick.com')", user.getUid()) > 0; } return false; @@ -555,7 +555,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { "UPDATE jids SET active=? WHERE user_id=? AND jid=?"); int newStatus = jidStatus == UserService.ActiveStatus.Active ? 1 : 0; preparedStatement.setInt(1, newStatus); - preparedStatement.setInt(2, user.getUID()); + preparedStatement.setInt(2, user.getUid()); preparedStatement.setString(3, JID); return preparedStatement; @@ -568,7 +568,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { @Override public List<String> getAllJIDs(final User user) { return getJdbcTemplate().queryForList( - "SELECT jid FROM jids WHERE user_id=?", String.class, user.getUID()); + "SELECT jid FROM jids WHERE user_id=?", String.class, user.getUid()); } @Transactional(readOnly = true) @@ -577,13 +577,13 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { return getJdbcTemplate().query( "SELECT account,authcode FROM auth WHERE user_id=? AND protocol='xmpp'", (rs, num) -> new Auth(rs.getString(1), rs.getString(2)), - user.getUID()); + user.getUid()); } @Transactional(readOnly = true) @Override public List<String> getEmails(final User user) { - return getJdbcTemplate().queryForList("SELECT email FROM emails WHERE user_id=?", String.class, user.getUID()); + return getJdbcTemplate().queryForList("SELECT email FROM emails WHERE user_id=?", String.class, user.getUid()); } @Transactional(readOnly = true) @@ -592,7 +592,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { try { return getJdbcTemplate().queryForObject( "SELECT email,subscr_hour FROM emails WHERE user_id=? AND subscr_hour IS NOT NULL", - (rs, num) -> new EmailOpts(rs.getString(1), rs.getInt(2)), user.getUID()); + (rs, num) -> new EmailOpts(rs.getString(1), rs.getInt(2)), user.getUid()); } catch (EmptyResultDataAccessException e) { return null; } @@ -605,7 +605,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { return getJdbcTemplate().queryForObject( "SELECT hash FROM mail WHERE user_id=?", String.class, - user.getUID()) + user.getUid()) + "@mail.juick.com"; } catch (EmptyResultDataAccessException e) { return ""; |