aboutsummaryrefslogtreecommitdiff
path: root/server-core/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-11-15 14:21:27 +0300
committerGravatar Vitaly Takmazov2016-11-15 14:21:27 +0300
commit51d9de02265d6cc9d6045d79497d2a987ae2f7f7 (patch)
treed7dd2e534452cab45b8ebdba1e52c498951c5035 /server-core/src/main
parent32a6feb195171e06d60117ad758cc8beb50e5ca3 (diff)
core classes are now serializeable with JAXB (to use as babbler extension)
Diffstat (limited to 'server-core/src/main')
-rw-r--r--server-core/src/main/java/com/juick/server/MessagesQueries.java32
-rw-r--r--server-core/src/main/java/com/juick/server/PMQueries.java14
-rw-r--r--server-core/src/main/java/com/juick/server/PrivacyQueries.java8
-rw-r--r--server-core/src/main/java/com/juick/server/ShowQueries.java2
-rw-r--r--server-core/src/main/java/com/juick/server/SubscriptionsQueries.java20
-rw-r--r--server-core/src/main/java/com/juick/server/UserQueries.java52
-rw-r--r--server-core/src/main/java/com/juick/server/protocol/JuickProtocol.java48
-rw-r--r--server-core/src/main/java/com/juick/service/MessagesServiceImpl.java32
-rw-r--r--server-core/src/main/java/com/juick/service/PMQueriesServiceImpl.java14
-rw-r--r--server-core/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java12
-rw-r--r--server-core/src/main/java/com/juick/service/ShowQueriesServiceImpl.java8
-rw-r--r--server-core/src/main/java/com/juick/service/SubscriptionServiceImpl.java20
-rw-r--r--server-core/src/main/java/com/juick/service/UserServiceImpl.java52
13 files changed, 157 insertions, 157 deletions
diff --git a/server-core/src/main/java/com/juick/server/MessagesQueries.java b/server-core/src/main/java/com/juick/server/MessagesQueries.java
index 8a5c094c..9d4284bc 100644
--- a/server-core/src/main/java/com/juick/server/MessagesQueries.java
+++ b/server-core/src/main/java/com/juick/server/MessagesQueries.java
@@ -47,19 +47,19 @@ public class MessagesQueries {
@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) {
@@ -72,7 +72,7 @@ public class MessagesQueries {
// 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));
@@ -272,12 +272,12 @@ public class MessagesQueries {
+ "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));
@@ -299,8 +299,8 @@ public class MessagesQueries {
+ "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/server/PMQueries.java b/server-core/src/main/java/com/juick/server/PMQueries.java
index d7855002..c79c04b6 100644
--- a/server-core/src/main/java/com/juick/server/PMQueries.java
+++ b/server-core/src/main/java/com/juick/server/PMQueries.java
@@ -73,8 +73,8 @@ public class PMQueries {
+ "WHERE pm_streams.user_id_to=? "
+ "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;
}, uid);
@@ -88,7 +88,7 @@ public class PMQueries {
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;
@@ -106,8 +106,8 @@ public class PMQueries {
(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));
@@ -122,8 +122,8 @@ public class PMQueries {
(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/server/PrivacyQueries.java b/server-core/src/main/java/com/juick/server/PrivacyQueries.java
index 53b13505..40fc82c4 100644
--- a/server-core/src/main/java/com/juick/server/PrivacyQueries.java
+++ b/server-core/src/main/java/com/juick/server/PrivacyQueries.java
@@ -12,20 +12,20 @@ public class PrivacyQueries {
Removed, Added
}
public static PrivacyResult blacklistUser(JdbcTemplate jdbc, User user, User target) {
- int result = jdbc.update("DELETE FROM bl_users WHERE user_id=? AND bl_user_id=?", user.getUID(), target.getUID());
+ int result = jdbc.update("DELETE FROM bl_users WHERE user_id=? AND bl_user_id=?", user.getUid(), target.getUid());
if (result > 0) {
return PrivacyResult.Removed;
} else {
- jdbc.update("INSERT INTO bl_users(user_id,bl_user_id) VALUES (?,?)", user.getUID(), target.getUID());
+ jdbc.update("INSERT INTO bl_users(user_id,bl_user_id) VALUES (?,?)", user.getUid(), target.getUid());
return PrivacyResult.Added;
}
}
public static PrivacyResult blacklistTag(JdbcTemplate jdbc, User user, Tag tag) {
- int result = jdbc.update("DELETE FROM bl_tags WHERE user_id=? AND tag_id=?", user.getUID(), tag.TID);
+ int result = jdbc.update("DELETE FROM bl_tags WHERE user_id=? AND tag_id=?", user.getUid(), tag.TID);
if (result > 0) {
return PrivacyResult.Removed;
} else {
- jdbc.update("INSERT INTO bl_tags(user_id,tag_id) VALUES (?,?)", user.getUID(), tag.TID);
+ jdbc.update("INSERT INTO bl_tags(user_id,tag_id) VALUES (?,?)", user.getUid(), tag.TID);
return PrivacyResult.Added;
}
}
diff --git a/server-core/src/main/java/com/juick/server/ShowQueries.java b/server-core/src/main/java/com/juick/server/ShowQueries.java
index b55117c1..fde388c3 100644
--- a/server-core/src/main/java/com/juick/server/ShowQueries.java
+++ b/server-core/src/main/java/com/juick/server/ShowQueries.java
@@ -18,7 +18,7 @@ public class ShowQueries {
"AND subscr_users.user_id NOT IN (SELECT bl_user_id FROM bl_users WHERE user_id=?) " +
"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());
+ String.class, forUser.getUid(), forUser.getUid(), forUser.getUid(), forUser.getUid());
}
public static List<String> getTopUsers(JdbcTemplate sql) {
diff --git a/server-core/src/main/java/com/juick/server/SubscriptionsQueries.java b/server-core/src/main/java/com/juick/server/SubscriptionsQueries.java
index 9a09a5cd..08d704d9 100644
--- a/server-core/src/main/java/com/juick/server/SubscriptionsQueries.java
+++ b/server-core/src/main/java/com/juick/server/SubscriptionsQueries.java
@@ -36,12 +36,12 @@ public class SubscriptionsQueries {
User author = MessagesQueries.getMessageAuthor(sql, mid);
List<User> userids = UserQueries.getUserReaders(sql, 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 = MessagesQueries.getMessageTagsIDs(sql, mid);
if (tags.size() > 0) {
List<Integer> tagUsers = sql.queryForList("SELECT suser_id FROM subscr_tags " +
"WHERE tag_id IN (" + StringUtils.arrayToCommaDelimitedString(tags.toArray()) + ") AND suser_id!=? " +
- " AND suser_id NOT IN (SELECT user_id FROM bl_users WHERE bl_user_id=?)", Integer.class, uid, author.getUID());
+ " AND suser_id NOT IN (SELECT user_id FROM bl_users WHERE bl_user_id=?)", Integer.class, uid, author.getUid());
set.addAll(tagUsers);
}
return UserQueries.getUsersByID(sql, new ArrayList<>(set));
@@ -84,19 +84,19 @@ public class SubscriptionsQueries {
}
public static boolean subscribeUser(JdbcTemplate sql, User user, User toUser) {
return sql.update("INSERT IGNORE INTO subscr_users(user_id,suser_id) VALUES (?,?)",
- toUser.getUID(), user.getUID()) == 1;
+ toUser.getUid(), user.getUid()) == 1;
}
public static boolean unSubscribeUser(JdbcTemplate sql, User user, User fromUser) {
return sql.update("DELETE FROM subscr_users WHERE suser_id=? AND user_id=?",
- user.getUID(), fromUser.getUID()) > 0;
+ user.getUid(), fromUser.getUid()) > 0;
}
public static boolean subscribeTag(JdbcTemplate sql, User user, Tag toTag) {
return sql.update("INSERT IGNORE INTO subscr_tags(tag_id,suser_id) VALUES (?,?)",
- toTag.TID, user.getUID()) == 1;
+ toTag.TID, user.getUid()) == 1;
}
public static boolean unSubscribeTag(JdbcTemplate sql, User user, Tag toTag) {
return sql.update("DELETE FROM subscr_tags WHERE tag_id=? AND suser_id=?",
- toTag.TID, user.getUID()) > 0;
+ toTag.TID, user.getUid()) > 0;
}
public static NotifyOpts getNotifyOptions(JdbcTemplate sql, User user) {
@@ -108,7 +108,7 @@ public class SubscriptionsQueries {
options.setSubscriptionsEnabled(rs.getInt(2) > 0);
options.setRecommendationsEnabled(rs.getInt(3) > 0);
return options;
- }, user.getUID());
+ }, user.getUid());
} catch (EmptyResultDataAccessException e) {
return new NotifyOpts();
}
@@ -116,10 +116,10 @@ public class SubscriptionsQueries {
public static boolean setNotifyOptions(JdbcTemplate sql, User user, NotifyOpts options) {
return sql.update("UPDATE useroptions SET jnotify=? WHERE user_id=?", options.isRepliesEnabled() ? 1 : 0,
- user.getUID()) > 0 &&
+ user.getUid()) > 0 &&
sql.update("UPDATE useroptions SET subscr_notify=? WHERE user_id=?", options.isSubscriptionsEnabled() ? 1 : 0,
- user.getUID()) > 0 &&
+ user.getUid()) > 0 &&
sql.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/server/UserQueries.java b/server-core/src/main/java/com/juick/server/UserQueries.java
index bc368390..7400e6b2 100644
--- a/server-core/src/main/java/com/juick/server/UserQueries.java
+++ b/server-core/src/main/java/com/juick/server/UserQueries.java
@@ -47,9 +47,9 @@ public class UserQueries {
@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;
}
}
@@ -150,8 +150,8 @@ public class UserQueries {
+ "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;
});
@@ -220,7 +220,7 @@ public class UserQueries {
if (realPassword.equals(password)) {
User user = UserQueries.getUserByName(sql, username);
if (user != null) {
- return user.getUID();
+ return user.getUid();
} else {
return -1;
}
@@ -233,12 +233,12 @@ public class UserQueries {
}
public static boolean updatePassword(JdbcTemplate sql, User user, String newPassword) {
- return user.getUID() > 0 && sql.update("UPDATE users SET passw=? WHERE id=?", newPassword, user.getUID()) > 0;
+ return user.getUid() > 0 && sql.update("UPDATE users SET passw=? WHERE id=?", newPassword, user.getUid()) > 0;
}
public static String updateSecretEmail(JdbcTemplate sql, User user) {
String newHash = UserUtils.generateHash(16);
- if (sql.update("INSERT INTO mail(user_id,hash) VALUES (?,?) ON DUPLICATE KEY UPDATE hash=?", user.getUID(), newHash, newHash) > 0) {
+ if (sql.update("INSERT INTO mail(user_id,hash) VALUES (?,?) ON DUPLICATE KEY UPDATE hash=?", user.getUid(), newHash, newHash) > 0) {
return newHash;
}
return "";
@@ -265,7 +265,7 @@ public class UserQueries {
info.setUrl(rs.getString(3));
info.setDescription(rs.getString(4));
return info;
- }), user.getUID());
+ }), user.getUid());
} catch (EmptyResultDataAccessException e) {
return new UserInfo();
}
@@ -273,7 +273,7 @@ public class UserQueries {
public static boolean updateUserInfo(JdbcTemplate sql, User user, UserInfo info) {
return sql.update("INSERT INTO usersinfo(user_id,fullname,country,url,descr) VALUES (?,?,?,?,?) " +
- "ON DUPLICATE KEY UPDATE fullname=?,country=?,url=?,descr=?", user.getUID(), info.getFullName(),
+ "ON DUPLICATE KEY UPDATE fullname=?,country=?,url=?,descr=?", user.getUid(), info.getFullName(),
info.getCountry(), info.getUrl(), info.getDescription(), info.getFullName(),
info.getCountry(), info.getUrl(), info.getDescription()) > 0;
}
@@ -345,8 +345,8 @@ public class UserQueries {
"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, cnt);
}
@@ -357,8 +357,8 @@ public class UserQueries {
"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);
}
@@ -370,8 +370,8 @@ public class UserQueries {
"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, uid);
}
@@ -381,8 +381,8 @@ public class UserQueries {
"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);
}
@@ -392,9 +392,9 @@ public class UserQueries {
if (sql.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 sql.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;
@@ -445,7 +445,7 @@ public class UserQueries {
"UPDATE jids SET active=? WHERE user_id=? AND jid=?");
int newStatus = jidStatus == ActiveStatus.Active ? 1 : 0;
preparedStatement.setInt(1, newStatus);
- preparedStatement.setInt(2, user.getUID());
+ preparedStatement.setInt(2, user.getUid());
preparedStatement.setString(3, JID);
return preparedStatement;
@@ -455,22 +455,22 @@ public class UserQueries {
}
public static List<String> getAllJIDs(JdbcTemplate sql, User user) {
- return sql.queryForList("SELECT jid FROM jids WHERE user_id=?", String.class, user.getUID());
+ return sql.queryForList("SELECT jid FROM jids WHERE user_id=?", String.class, user.getUid());
}
public static List<Auth> getAuthCodes(JdbcTemplate sql, User user) {
return sql.query("SELECT account,authcode FROM auth WHERE user_id=? AND protocol='xmpp'",
- (rs, num) -> new Auth(rs.getString(1), rs.getString(2)), user.getUID());
+ (rs, num) -> new Auth(rs.getString(1), rs.getString(2)), user.getUid());
}
public static List<String> getEmails(JdbcTemplate sql, User user) {
- return sql.queryForList("SELECT email FROM emails WHERE user_id=?", String.class, user.getUID());
+ return sql.queryForList("SELECT email FROM emails WHERE user_id=?", String.class, user.getUid());
}
public static EmailOpts getEmailOpts(JdbcTemplate sql, User user) {
try {
return sql.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;
}
@@ -478,7 +478,7 @@ public class UserQueries {
public static String getEmailHash(JdbcTemplate sql, User user) {
try {
- return sql.queryForObject("SELECT hash FROM mail WHERE user_id=?", String.class, user.getUID())
+ return sql.queryForObject("SELECT hash FROM mail WHERE user_id=?", String.class, user.getUid())
+ "@mail.juick.com";
} catch (EmptyResultDataAccessException e) {
return "";
diff --git a/server-core/src/main/java/com/juick/server/protocol/JuickProtocol.java b/server-core/src/main/java/com/juick/server/protocol/JuickProtocol.java
index e9e129a9..f1e98eb9 100644
--- a/server-core/src/main/java/com/juick/server/protocol/JuickProtocol.java
+++ b/server-core/src/main/java/com/juick/server/protocol/JuickProtocol.java
@@ -68,8 +68,8 @@ public class JuickProtocol {
public ProtocolReply postMessage(User user, String input) {
List<Tag> tags = TagQueries.fromString(sql, input, false);
String body = input.substring(TagUtils.toString(tags).length());
- int mid = MessagesQueries.createMessage(sql, user.getUID(), body, null, tags);
- SubscriptionsQueries.subscribeMessage(sql, mid, user.getUID());
+ int mid = MessagesQueries.createMessage(sql, user.getUid(), body, null, tags);
+ SubscriptionsQueries.subscribeMessage(sql, mid, user.getUid());
//app.events().publishEvent(new JuickMessageEvent(app.messages().getMessage(mid)));
return new ProtocolReply("New message posted.\n#" + mid + " " + baseUri + mid,
Optional.of(json.serializeList(Collections.singletonList(MessagesQueries.getMessage(sql, mid)))));
@@ -79,7 +79,7 @@ public class JuickProtocol {
public ProtocolReply commandLast(User user, String... arguments) {
// number of + is the page count
int page = arguments[0].length() - 1;
- List<Integer> mids = MessagesQueries.getAll(sql, user.getUID(), page);
+ List<Integer> mids = MessagesQueries.getAll(sql, user.getUid(), page);
List<Message> messages = MessagesQueries.getMessages(sql, mids);
return new ProtocolReply("Last messages: \n" + String.join("\n", messages.stream().map(PlainTextFormatter::formatPost)
.collect(Collectors.toList())), Optional.of(json.serializeList(messages)));
@@ -91,8 +91,8 @@ public class JuickProtocol {
List<User> blusers;
List<String> bltags;
- blusers = UserQueries.getUserBLUsers(sql, user_from.getUID());
- bltags = TagQueries.getUserBLTags(sql, user_from.getUID());
+ blusers = UserQueries.getUserBLUsers(sql, user_from.getUid());
+ bltags = TagQueries.getUserBLTags(sql, user_from.getUid());
String txt = "";
@@ -107,7 +107,7 @@ public class JuickProtocol {
}
if (blusers.size() > 0) {
for (User bluser : blusers) {
- txt += "@" + bluser.getUName() + "\n";
+ txt += "@" + bluser.getName() + "\n";
}
}
if (txt.isEmpty()) {
@@ -175,7 +175,7 @@ public class JuickProtocol {
@UserCommand(pattern = "\\*", help = "* - Show your tags")
public ProtocolReply commandTags(User currentUser, String... args) {
- List<Tag> tags = TagQueries.getUserTagsAll(sql, currentUser.getUID());
+ List<Tag> tags = TagQueries.getUserTagsAll(sql, currentUser.getUid());
String msg = "Your tags: (tag - messages)\n" +
tags.stream()
.map(t -> String.format("\n*%s - %d", t.getName(), t.UsageCnt)).collect(Collectors.joining());
@@ -184,7 +184,7 @@ public class JuickProtocol {
@UserCommand(pattern = "!", help = "! - Show your favorite messages")
public ProtocolReply commandFavorites(User currentUser, String... args) {
- List<Integer> mids = MessagesQueries.getUserRecommendations(sql, currentUser.getUID(), 0);
+ List<Integer> mids = MessagesQueries.getUserRecommendations(sql, currentUser.getUid(), 0);
if (mids.size() > 0) {
List<Message> messages = MessagesQueries.getMessages(sql, mids);
return new ProtocolReply("Favorite messages: \n" + String.join("\n", messages.stream().map(PlainTextFormatter::formatPost)
@@ -199,7 +199,7 @@ public class JuickProtocol {
User blogUser = UserQueries.getUserByName(sql, arguments[0]);
int page = arguments[1].length();
if (blogUser != null) {
- List<Integer> mids = MessagesQueries.getUserBlog(sql, blogUser.getUID(), 0, page);
+ List<Integer> mids = MessagesQueries.getUserBlog(sql, blogUser.getUid(), 0, page);
List<Message> messages = MessagesQueries.getMessages(sql, mids);
return new ProtocolReply(String.format("Last messages from @%s:\n%s", arguments[0],
String.join("\n", messages.stream()
@@ -214,7 +214,7 @@ public class JuickProtocol {
public ProtocolReply commandDel(User user, String... args) {
try {
int mid = Integer.parseInt(args[0]);
- if (MessagesQueries.deleteMessage(sql, user.getUID(), mid)) {
+ if (MessagesQueries.deleteMessage(sql, user.getUid(), mid)) {
return new ProtocolReply(String.format("Message %s deleted", mid), Optional.empty());
}
} catch (NumberFormatException e) {
@@ -226,7 +226,7 @@ public class JuickProtocol {
@UserCommand(pattern = "^\\s*login\\s*$", patternFlags = Pattern.CASE_INSENSITIVE,
help = "LOGIN - log in to Juick website")
public ProtocolReply commandLogin(User user, String... arguments) {
- return new ProtocolReply(baseUri + "?" + UserQueries.getHashByUID(sql, user.getUID()),
+ return new ProtocolReply(baseUri + "?" + UserQueries.getHashByUID(sql, user.getUid()),
Optional.empty());
}
@@ -234,7 +234,7 @@ public class JuickProtocol {
public ProtocolReply commandMyFeed(User user, String... arguments) {
// number of # is the page count
int page = arguments[0].length() - 1;
- List<Integer> mids = MessagesQueries.getMyFeed(sql, user.getUID(), page);
+ List<Integer> mids = MessagesQueries.getMyFeed(sql, user.getUid(), page);
List<Message> messages = MessagesQueries.getMessages(sql, mids);
// TODO: add instructions for empty feed
return new ProtocolReply("Your feed: \n" + String.join("\n",
@@ -286,11 +286,11 @@ public class JuickProtocol {
}
if (uid_to > 0) {
- if (!UserQueries.isInBLAny(sql, uid_to, user_from.getUID())) {
- if (PMQueries.createPM(sql, user_from.getUID(), uid_to, body)) {
+ if (!UserQueries.isInBLAny(sql, uid_to, user_from.getUid())) {
+ if (PMQueries.createPM(sql, user_from.getUid(), uid_to, body)) {
//jid_to = UserQueries.getJIDsbyUID(sql, uid_to);
if (jid_to != null) {
- haveInRoster = PMQueries.havePMinRoster(sql, user_from.getUID(), jid_to);
+ haveInRoster = PMQueries.havePMinRoster(sql, user_from.getUid(), jid_to);
}
ret = 200;
} else {
@@ -316,11 +316,11 @@ public class JuickProtocol {
mm.to = new JID(jid_to);
mm.type = Message.Type.chat;
if (haveInRoster) {
- mm.from = new JID(user_from.getUName(), getDomain(), "Juick");
+ mm.from = new JID(user_from.getName(), getDomain(), "Juick");
mm.body = body;
} else {
mm.from = new JID("juick", getDomain(), "Juick");
- mm.body = "Private message from @" + user_from.getUName() + ":\n" + body;
+ mm.body = "Private message from @" + user_from.getName() + ":\n" + body;
}
return Collections.singletonList(mm);
}
@@ -373,13 +373,13 @@ public class JuickProtocol {
String txt = args[5];
List<Tag> messageTags = TagQueries.fromString(sql, txt, true);
if (messageTags.size() > 0) {
- if (user.getUID() != MessagesQueries.getMessageAuthor(sql, mid).getUID()) {
+ if (user.getUid() != MessagesQueries.getMessageAuthor(sql, mid).getUid()) {
return new ProtocolReply("It is not your message", Optional.empty());
}
TagQueries.updateTags(sql, mid, messageTags);
return new ProtocolReply("Tags are updated", Optional.empty());
} else {
- int newrid = MessagesQueries.createReply(sql, mid, rid, user.getUID(), txt, null);
+ int newrid = MessagesQueries.createReply(sql, mid, rid, user.getUid(), txt, null);
return new ProtocolReply("Reply posted.\n#" + mid + "/" + newrid + " "
+ baseUri + mid + "/" + newrid,
Optional.of(json.serializeList(Collections.singletonList(MessagesQueries.getReply(sql, mid, newrid)))));
@@ -397,11 +397,11 @@ public class JuickProtocol {
return new ProtocolReply("Error", Optional.empty());
}
if (subscribe) {
- if (SubscriptionsQueries.subscribeMessage(sql, mid, user.getUID())) {
+ if (SubscriptionsQueries.subscribeMessage(sql, mid, user.getUid())) {
return new ProtocolReply("Subscribed", Optional.empty());
}
} else {
- if (SubscriptionsQueries.unSubscribeMessage(sql, mid, user.getUID())) {
+ if (SubscriptionsQueries.unSubscribeMessage(sql, mid, user.getUid())) {
return new ProtocolReply("Unsubscribed from #" + mid, Optional.empty());
}
return new ProtocolReply("You was not subscribed to #" + mid, Optional.empty());
@@ -413,7 +413,7 @@ public class JuickProtocol {
public ProtocolReply commandSubscribeUser(User user, String... args) {
boolean subscribe = args[0].equalsIgnoreCase("s");
User toUser = UserQueries.getUserByName(sql, args[1]);
- if (toUser.getUID() > 0) {
+ if (toUser.getUid() > 0) {
if (subscribe) {
if (SubscriptionsQueries.subscribeUser(sql, user, toUser)) {
return new ProtocolReply("Subscribed", Optional.empty());
@@ -422,9 +422,9 @@ public class JuickProtocol {
}
} else {
if (SubscriptionsQueries.unSubscribeUser(sql, user, toUser)) {
- return new ProtocolReply("Unsubscribed from @" + toUser.getUName(), Optional.empty());
+ return new ProtocolReply("Unsubscribed from @" + toUser.getName(), Optional.empty());
}
- return new ProtocolReply("You was not subscribed to @" + toUser.getUName(), Optional.empty());
+ return new ProtocolReply("You was not subscribed to @" + toUser.getName(), Optional.empty());
}
}
return new ProtocolReply("Error", Optional.empty());
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 "";