From acddd380e1868e28491eaf85f05e87d7a47a123f Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 16 Dec 2016 17:09:38 +0300 Subject: Anonym -> Anonymous --- .../juick/server/security/entities/AnonymUser.java | 132 --------------------- .../server/security/entities/AnonymousUser.java | 132 +++++++++++++++++++++ .../juick/server/security/entities/JuickUser.java | 2 +- .../src/main/java/com/juick/util/UserUtils.java | 4 +- 4 files changed, 135 insertions(+), 135 deletions(-) delete mode 100644 juick-server/src/main/java/com/juick/server/security/entities/AnonymUser.java create mode 100644 juick-server/src/main/java/com/juick/server/security/entities/AnonymousUser.java (limited to 'juick-server/src/main/java/com/juick') diff --git a/juick-server/src/main/java/com/juick/server/security/entities/AnonymUser.java b/juick-server/src/main/java/com/juick/server/security/entities/AnonymUser.java deleted file mode 100644 index 2cc692a2..00000000 --- a/juick-server/src/main/java/com/juick/server/security/entities/AnonymUser.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.juick.server.security.entities; - -import com.juick.User; - -/** - * Created by aalexeev on 12/11/16. - */ -public final class AnonymUser extends User { - public static final AnonymUser INSTANCE = new AnonymUser(); - - private AnonymUser() { - super.setUid(getUid()); - super.setName(getName()); - super.setAvatar(getAvatar()); - super.setFullName(getFullName()); - super.setJid(getJid()); - super.setMessagesCount(getMessagesCount()); - super.setAuthHash(getAuthHash()); - super.setBanned(isBanned()); - super.setCredentials(getCredentials()); - super.setLang(getLang()); - } - - @Override - public boolean equals(Object obj) { - return obj == this || obj instanceof AnonymUser; - } - - @Override - public int getUid() { - return 0; - } - - @Override - public String getName() { - return "Anonymous"; - } - - @Override - public String getFullName() { - return getName(); - } - - @Override - public String getJid() { - return "anonym@localhost"; - } - - @Override - public String getAuthHash() { - return null; - } - - @Override - public Integer getUnreadCount() { - return 0; - } - - @Override - public boolean isBanned() { - return false; - } - - @Override - public Object getAvatar() { - return null; - } - - @Override - public String getCredentials() { - return null; - } - - @Override - public String getLang() { - return "__"; - } - - @Override - public int getMessagesCount() { - return 0; - } - - @Override - public boolean isAnonym() { - return true; - } - - @Override - public void setUid(int uid) { - } - - @Override - public void setName(String name) { - } - - @Override - public void setFullName(String fullName) { - } - - @Override - public void setJid(String jid) { - } - - @Override - public void setAuthHash(String authHash) { - } - - @Override - public void setUnreadCount(Integer count) { - } - - @Override - public void setBanned(boolean banned) { - } - - @Override - public void setAvatar(Object avatar) { - } - - @Override - public void setCredentials(String credentials) { - } - - @Override - public void setLang(String lang) { - } - - @Override - public void setMessagesCount(int messagesCount) { - } -} diff --git a/juick-server/src/main/java/com/juick/server/security/entities/AnonymousUser.java b/juick-server/src/main/java/com/juick/server/security/entities/AnonymousUser.java new file mode 100644 index 00000000..5ee9527f --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/security/entities/AnonymousUser.java @@ -0,0 +1,132 @@ +package com.juick.server.security.entities; + +import com.juick.User; + +/** + * Created by aalexeev on 12/11/16. + */ +public final class AnonymousUser extends User { + public static final AnonymousUser INSTANCE = new AnonymousUser(); + + private AnonymousUser() { + super.setUid(getUid()); + super.setName(getName()); + super.setAvatar(getAvatar()); + super.setFullName(getFullName()); + super.setJid(getJid()); + super.setMessagesCount(getMessagesCount()); + super.setAuthHash(getAuthHash()); + super.setBanned(isBanned()); + super.setCredentials(getCredentials()); + super.setLang(getLang()); + } + + @Override + public boolean equals(Object obj) { + return obj == this || obj instanceof AnonymousUser; + } + + @Override + public int getUid() { + return 0; + } + + @Override + public String getName() { + return "Anonymous"; + } + + @Override + public String getFullName() { + return getName(); + } + + @Override + public String getJid() { + return "anonym@localhost"; + } + + @Override + public String getAuthHash() { + return null; + } + + @Override + public Integer getUnreadCount() { + return 0; + } + + @Override + public boolean isBanned() { + return false; + } + + @Override + public Object getAvatar() { + return null; + } + + @Override + public String getCredentials() { + return null; + } + + @Override + public String getLang() { + return "__"; + } + + @Override + public int getMessagesCount() { + return 0; + } + + @Override + public boolean isAnonymous() { + return true; + } + + @Override + public void setUid(int uid) { + } + + @Override + public void setName(String name) { + } + + @Override + public void setFullName(String fullName) { + } + + @Override + public void setJid(String jid) { + } + + @Override + public void setAuthHash(String authHash) { + } + + @Override + public void setUnreadCount(Integer count) { + } + + @Override + public void setBanned(boolean banned) { + } + + @Override + public void setAvatar(Object avatar) { + } + + @Override + public void setCredentials(String credentials) { + } + + @Override + public void setLang(String lang) { + } + + @Override + public void setMessagesCount(int messagesCount) { + } +} diff --git a/juick-server/src/main/java/com/juick/server/security/entities/JuickUser.java b/juick-server/src/main/java/com/juick/server/security/entities/JuickUser.java index 596c95d1..f49be1e2 100644 --- a/juick-server/src/main/java/com/juick/server/security/entities/JuickUser.java +++ b/juick-server/src/main/java/com/juick/server/security/entities/JuickUser.java @@ -19,7 +19,7 @@ public class JuickUser implements UserDetails { public static final List USER_AUTHORITY = Collections.singletonList(ROLE_USER); public static final List ANONYM_AUTHORITY = Collections.singletonList(ROLE_ANONYM); - public static final JuickUser ANONYM_USER = new JuickUser(AnonymUser.INSTANCE, ANONYM_AUTHORITY); + public static final JuickUser ANONYM_USER = new JuickUser(AnonymousUser.INSTANCE, ANONYM_AUTHORITY); private final com.juick.User user; private final Collection authorities; diff --git a/juick-server/src/main/java/com/juick/util/UserUtils.java b/juick-server/src/main/java/com/juick/util/UserUtils.java index 8be415c9..3d78b5b5 100644 --- a/juick-server/src/main/java/com/juick/util/UserUtils.java +++ b/juick-server/src/main/java/com/juick/util/UserUtils.java @@ -1,7 +1,7 @@ package com.juick.util; import com.juick.User; -import com.juick.server.security.entities.AnonymUser; +import com.juick.server.security.entities.AnonymousUser; import com.juick.server.security.entities.JuickUser; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; @@ -44,6 +44,6 @@ public class UserUtils { if (principal instanceof User) return (User) principal; - return AnonymUser.INSTANCE; + return AnonymousUser.INSTANCE; } } -- cgit v1.2.3