Newer
Older
CosmosClient / app / src / main / java / com / example / cosmosclient / entities / User.java
  1. package com.example.cosmosclient.entities;
  2.  
  3. import java.util.HashSet;
  4. import java.util.Set;
  5.  
  6. public class User {
  7. /**
  8. * USER用のクラス
  9. *
  10. * @param uId string //LONGに変更
  11. * @param uri String
  12. * @param name String
  13. * @param iconUri String iconの保存先
  14. * @param login Boolean トークンが存在するか否か
  15. * @param groups Set<Group> 所属するグループ
  16. * @param tokens String userが持トークン一覧
  17. *
  18. * TODO: Tokenのデータベース接続
  19. * TODO: tokenの持ち方要検討
  20. */
  21.  
  22. public String uId, uri, name, iconUri;
  23. public boolean login = true;
  24. public Set<Group> groups = new HashSet<>();//HashSetでいいのかな?
  25. //仕様ではStringを返すため
  26. //public Set<Token> tokens = new HashSet<>();
  27. //public Set<String> tokens = new HashSet<>();
  28. public String token;
  29. private String dummyToken = "a9965652-c2ec-4a0d-a78a-b457e8b2deca";
  30.  
  31. public User() {
  32.  
  33. }
  34. public User(String name, String uId, String uri, String iconUri) {
  35. setuId(uId);
  36. setUri(uri);
  37. setName(name);
  38. setIconUri(iconUri);
  39. setToken(this.dummyToken);
  40. //addToken(this.dummyToken);
  41. this.login = true;
  42. }
  43.  
  44. public String getuId() {
  45. return uId;
  46. }
  47.  
  48. public void setuId(String uId) {
  49. this.uId = uId;
  50. }
  51.  
  52. public String getUri() {
  53. return uri;
  54. }
  55.  
  56. public void setUri(String uri) {
  57. this.uri = uri;
  58. }
  59.  
  60. public String getName() {
  61. return name;
  62. }
  63.  
  64. public void setName(String name) {
  65. this.name = name;
  66. }
  67.  
  68. public String getIconUri() {
  69. return iconUri;
  70. }
  71.  
  72. public void setIconUri(String iconUri) {
  73. this.iconUri = iconUri;
  74. }
  75.  
  76. public boolean getLogin() {
  77. return login;
  78. }
  79.  
  80. public void setLogin(boolean login) {
  81. this.login = login;
  82. }
  83.  
  84. public void setToken(String token) {
  85. this.token = token;
  86. }
  87.  
  88. public String getToken() {
  89. return token;
  90. }
  91.  
  92. /*
  93. * //仕様ではStringで返すため
  94. * public Set<String> getTokens(){
  95. * return tokens;
  96. * }
  97. * public void setTokens(Set<String> tokens){
  98. * this.tokens=tokens;
  99. * }
  100. * public void addToken (String token){
  101. * tokens.add(token);
  102. * }
  103. */
  104.  
  105. public Set<Group> getGroups() {
  106. return groups;
  107. }
  108.  
  109. public void setGroups(Set<Group> groups) {
  110. this.groups = groups;
  111. }
  112.  
  113. public void addGroups(Group group){
  114. //テスト用
  115. //Group group = Groups.getInstance().getGroupByGid(gId);
  116. groups.add(group);
  117. }
  118. }