Newer
Older
CosmosClient / app / src / main / java / com / example / cosmosclient / entities / User.java
package com.example.cosmosclient.entities;

import java.util.HashSet;
import java.util.Set;

public class User {
    /**
     * USER用のクラス
     *
     * @param uId string //LONGに変更
     * @param uri String
     * @param name String
     * @param iconUri String iconの保存先
     * @param login Boolean トークンが存在するか否か
     * @param groups Set<Group> 所属するグループ
     * @param tokens String userが持トークン一覧
     *
     * TODO: Tokenのデータベース接続
     * TODO: tokenの持ち方要検討
     */

    public String uId, uri, name, iconUri;
    public boolean login = true;
    public Set<Group> groups = new HashSet<>();//HashSetでいいのかな?
    //仕様ではStringを返すため
    //public Set<Token> tokens = new HashSet<>();
    //public Set<String> tokens = new HashSet<>();
    public String token;
    private String dummyToken = "a9965652-c2ec-4a0d-a78a-b457e8b2deca";

    public User() {

    }
    public User(String name, String uId, String uri, String iconUri) {
        setuId(uId);
        setUri(uri);
        setName(name);
        setIconUri(iconUri);
        setToken(this.dummyToken);
        //addToken(this.dummyToken);
        this.login = true;
    }

    public String getuId() {
        return uId;
    }

    public void setuId(String uId) {
        this.uId = uId;
    }

    public String getUri() {
        return uri;
    }

    public void setUri(String uri) {
        this.uri = uri;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIconUri() {
        return iconUri;
    }

    public void setIconUri(String iconUri) {
        this.iconUri = iconUri;
    }

    public boolean getLogin() {
        return login;
    }

    public void setLogin(boolean login) {
        this.login = login;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getToken() {
        return token;
    }

    /*
     * //仕様ではStringで返すため
     * public Set<String> getTokens(){
     *     return tokens;
     * }
     * public void setTokens(Set<String> tokens){
     *     this.tokens=tokens;
     * }
     * public void addToken (String token){
     *     tokens.add(token);
     * }
     */

    public Set<Group> getGroups() {
        return groups;
    }

    public void setGroups(Set<Group> groups) {
        this.groups = groups;
    }

    public void addGroups(Group group){
        //テスト用
        //Group group = Groups.getInstance().getGroupByGid(gId);
        groups.add(group);
    }
}