diff options
author | Alexander Alexeev | 2016-11-21 13:37:53 +0700 |
---|---|---|
committer | Vitaly Takmazov | 2016-11-23 13:03:04 +0300 |
commit | e9aa20922c82bfad64adbcb6466ebdac23a84244 (patch) | |
tree | 9eb58c293fd7047f7b119d9f4937724a715b0ecd | |
parent | 9d3b2623dac8fe3af4d0a8d05dad8ea96ea92f3d (diff) |
field names for core objects are corrected ( standard name conventions used)
6 files changed, 40 insertions, 39 deletions
diff --git a/juick-core/src/main/java/com/juick/Tag.java b/juick-core/src/main/java/com/juick/Tag.java index 4ba3a812..3f5add6e 100644 --- a/juick-core/src/main/java/com/juick/Tag.java +++ b/juick-core/src/main/java/com/juick/Tag.java @@ -32,7 +32,6 @@ import java.util.Objects; @XmlRootElement(name = "tag", namespace = "http://juick.com/message") @XmlAccessorType(XmlAccessType.PROPERTY) public class Tag { - private String name; public int TID = 0; diff --git a/juick-core/src/main/java/com/juick/User.java b/juick-core/src/main/java/com/juick/User.java index c64c55d5..f71ec781 100644 --- a/juick-core/src/main/java/com/juick/User.java +++ b/juick-core/src/main/java/com/juick/User.java @@ -28,27 +28,27 @@ import javax.xml.bind.annotation.*; @XmlRootElement(name = "user", namespace = "http://juick.com/user") @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) public class User { - private int uid = 0; - private String name = null; - private Object Avatar = null; - private String FullName = null; - private String JID = null; - private int MessagesCount = 0; - private String AuthHash = null; - private boolean Banned = false; + private int uid; + private String name; + private Object avatar; + private String fullName; + private String jid; + private int messagesCount; + private String authHash; + private boolean banned; public User() { } public User(User u) { - setUid(u.getUid()); - setName(u.getName()); - Avatar = u.Avatar; - setFullName(u.getFullName()); - setJID(u.getJID()); - MessagesCount = u.MessagesCount; - setAuthHash(u.getAuthHash()); - Banned = u.Banned; + this.uid = u.getUid(); + this.name = u.getName(); + this.avatar = u.getAvatar(); + this.fullName = u.fullName; + this.jid = u.getJid(); + this.messagesCount = u.getUnreadCount(); + this.authHash = u.getAuthHash(); + this.banned = u.isBanned(); } @Override @@ -80,56 +80,56 @@ public class User { @JsonProperty("fullname") @XmlTransient public String getFullName() { - return FullName; + return fullName; } public void setFullName(String fullName) { - FullName = fullName; + this.fullName = fullName; } @JsonProperty("jid") - public String getJID() { - return JID; + public String getJid() { + return jid; } - public void setJID(String JID) { - this.JID = JID; + public void setJid(String jid) { + this.jid = jid; } @XmlTransient @JsonIgnore public String getAuthHash() { - return AuthHash; + return authHash; } public void setAuthHash(String authHash) { - AuthHash = authHash; + this.authHash = authHash; } @JsonProperty("unreadCount") @XmlTransient public Integer getUnreadCount() { - return MessagesCount; + return messagesCount; } public void setUnreadCount(Integer count) { - MessagesCount = count; + this.messagesCount = count; } @XmlTransient public boolean isBanned() { - return Banned; + return banned; } public void setBanned(boolean banned) { - Banned = banned; + this.banned = banned; } public Object getAvatar() { - return Avatar; + return avatar; } public void setAvatar(Object avatar) { - Avatar = avatar; + this.avatar = avatar; } } diff --git a/juick-core/src/main/java/com/juick/json/UserSerializer.java b/juick-core/src/main/java/com/juick/json/UserSerializer.java index 08d21d39..120645a6 100644 --- a/juick-core/src/main/java/com/juick/json/UserSerializer.java +++ b/juick-core/src/main/java/com/juick/json/UserSerializer.java @@ -52,8 +52,8 @@ public class UserSerializer extends JSONSerializer<User> { if (user.getFullName() != null) { json.put("fullname", user.getFullName()); } - if (user.getJID() != null) { - json.put("jid", user.getJID()); + if (user.getJid() != null) { + json.put("jid", user.getJid()); } if (user.getUnreadCount() > 0) { json.put("unreadCount", user.getUnreadCount()); diff --git a/juick-server/src/main/java/com/juick/server/UserQueries.java b/juick-server/src/main/java/com/juick/server/UserQueries.java index 7400e6b2..e91cb6b3 100644 --- a/juick-server/src/main/java/com/juick/server/UserQueries.java +++ b/juick-server/src/main/java/com/juick/server/UserQueries.java @@ -152,7 +152,7 @@ public class UserQueries { com.juick.User user = new com.juick.User(); user.setUid(rs.getInt(1)); user.setName(rs.getString(2)); - user.setJID(rs.getString(3)); + user.setJid(rs.getString(3)); return user; }); } diff --git a/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java b/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java index 6fa3790e..eb579712 100644 --- a/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java +++ b/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java @@ -248,16 +248,16 @@ public class JuickProtocol { String retValUpdated; if (input[0].toLowerCase().equals("on")) { newStatus = UserQueries.ActiveStatus.Active; - retValUpdated = "Notifications are activated for " + user.getJID(); + retValUpdated = "Notifications are activated for " + user.getJid(); } else { newStatus = UserQueries.ActiveStatus.Inactive; - retValUpdated = "Notifications are disabled for " + user.getJID(); + retValUpdated = "Notifications are disabled for " + user.getJid(); } - if (UserQueries.setActiveStatusForJID(sql, user.getJID(), newStatus)) { + if (UserQueries.setActiveStatusForJID(sql, user.getJid(), newStatus)) { return new ProtocolReply(retValUpdated, Optional.empty()); } else { - return new ProtocolReply(String.format("Subscriptions status for %s was not changed", user.getJID()), + return new ProtocolReply(String.format("Subscriptions status for %s was not changed", user.getJid()), Optional.empty()); } } diff --git a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java index 2c52582d..8bd3adef 100644 --- a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java @@ -33,9 +33,11 @@ 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.setName(rs.getString(2)); user.setBanned(rs.getBoolean(3)); + return user; } } @@ -174,7 +176,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { com.juick.User user = new com.juick.User(); user.setUid(rs.getInt(1)); user.setName(rs.getString(2)); - user.setJID(rs.getString(3)); + user.setJid(rs.getString(3)); return user; }); } |