<commit_before>package com.ninelephas.fabric.sdk.entity;

import io.netty.util.internal.StringUtil;
import org.hyperledger.fabric.sdk.Enrollment;
import org.hyperledger.fabric.sdk.User;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * Created by zouwei on 2017/4/18.
 */
public class UserEntity implements User, Serializable {

    private static final long serialVersionUID = 8077132186383604355L;

    private String name;

    private ArrayList<String> roles;

    private String account;

    private String affiliation;

    private Enrollment enrollment;

    private String mspID;

    private String secret;

    private UserEntity admin;

    public UserEntity(){
        super();
    }

    public UserEntity(String name, String mspID) {
        super();
        this.name = name;
        this.mspID = mspID;
    }

    public boolean isEnrolled() {
        return this.enrollment != null;
    }

    public boolean isRegistered() {
        return !StringUtil.isNullOrEmpty(this.secret);
    }

    public void setAdmin(UserEntity admin) {
        this.admin = admin;
    }

    public void setSecret(String secret) {
        this.secret = secret;
    }

    public void setName(String name) {
        this.name = name;<commit_msg>添加用户实体注释<commit_after>package com.ninelephas.fabric.sdk.entity;

import io.netty.util.internal.StringUtil;
import org.hyperledger.fabric.sdk.Enrollment;
import org.hyperledger.fabric.sdk.User;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * Created by zouwei on 2017/4/18.
 * 必须要实现fabric的User接口
 */
public class UserEntity implements User, Serializable {

    private static final long serialVersionUID = 8077132186383604355L;
    /**
     * 用户名，唯一确定一个用户，相当于id
     */
    private String name;
    /**
     * 用户角色
     */
    private ArrayList<String> roles;
    /**
     *
     */
    private String account;
    /**
     * 部门
     */
    private String affiliation;
    /**
     * 注册后的用户该字段不能为空
     */
    private Enrollment enrollment;

    private String mspID;
    /**
     * 注册后的用户该字段不能为空
     */
    private String secret;
    /**
     * 指定该用户所属管理员，该管理员必须已经存在
     */
    private UserEntity admin;

    public UserEntity(){
        super();
    }

    public UserEntity(String name, String mspID) {
        super();
        this.name = name;
        this.mspID = mspID;
    }

    public boolean isEnrolled() {
        return this.enrollment != null;
    }

    public boolean isRegistered() {
        return !StringUtil.isNullOrEmpty(this.secret);
    }

    public void setAdmin(UserEntity admin) {
        this.admin = admin;
    }

    public void setSecret(String secret) {
        this.secret = secret;
    }

    public void setName(String name) {
        this.name = name;
{'fraction_non_alphanumeric': 0.09696092619392185, 'fraction_numerical': 0.01881331403762663, 'mean_word_length': 2.4649122807017543, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5898110', 'n_tokens_mistral': 945, 'n_tokens_neox': 899, 'n_words': 196}