com.sammyun.entity.Member.java Source code

Java tutorial

Introduction

Here is the source code for com.sammyun.entity.Member.java

Source

/*
 * Copyright 2012-2014 sammyun.com.cn. All rights reserved.
 * Support: http://www.sammyun.com.cn
 * License: http://www.sammyun.com.cn/license
 */
package com.sammyun.entity;

import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.lang.StringUtils;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.sammyun.entity.MemberAttribute.Type;
import com.sammyun.entity.app.AppUser;
import com.sammyun.entity.attendance.TeacherAskLeave;
import com.sammyun.entity.attendance.TeacherAttendance;
import com.sammyun.entity.attendance.TimeCard;
import com.sammyun.entity.attendance.WorkScheduling;
import com.sammyun.entity.dict.ClassTeacherMap;
import com.sammyun.entity.dict.DictSchool;
import com.sammyun.entity.dict.PatriarchStudentMap;
import com.sammyun.entity.gd.AtUser;
import com.sammyun.entity.gd.DiaryAgree;
import com.sammyun.entity.gd.DiaryCollection;
import com.sammyun.entity.gd.DiaryComment;
import com.sammyun.entity.gd.DiaryTranspond;
import com.sammyun.entity.gd.GrowthDiary;
import com.sammyun.entity.message.Message;
import com.sammyun.hibernate.listener.MemberListener;
import com.sammyun.interceptor.MemberInterceptor;
import com.sammyun.util.DateUtil;
import com.sammyun.util.JsonUtils;

/**
 * Entity - 
 * 
 * @author Sencloud Team
 * @version 3.0
 */
@Entity
@Table(name = "t_pe_member")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "t_pe_member_sequence")
@EntityListeners(MemberListener.class)
public class Member extends BaseEntity {

    private static final long serialVersionUID = 1533130686714725835L;

    /**
     * 
     */
    public enum Gender {

        /**  */
        male,

        /**  */
        female
    }

    public enum MemberType {
        /** ? */
        teacher,
        /**  */
        patriarch,
        /** ? */
        system
    }

    /** ?? */
    public static final String CACHE_NAME = "member";

    /** "?"??? */
    public static final String PRINCIPAL_ATTRIBUTE_NAME = MemberInterceptor.class.getName() + ".PRINCIPAL";

    /** "??"Cookie?? */
    public static final String USERNAME_COOKIE_NAME = "username";

    /**  */
    public static final int ATTRIBUTE_VALUE_PROPERTY_COUNT = 10;

    /** ??? */
    public static final String ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX = "attributeValue";

    /** ??(?) */
    private String username;

    /** ? */
    private String mobile;

    /** ?? */
    private String realName;

    /** ??? */
    private String idCard;

    /** ? */
    private String password;

    /** ?? */
    private String signature;

    /** ? */
    private String iconPhoto;

    /** E-mail */
    private String email;

    /**  */
    private Long point;

    /** ?? */
    private Boolean isEnabled;

    /** ?? */
    private Boolean isLocked;

    /**  */
    private Integer loginFailureCount;

    /** ? */
    private Date lockedDate;

    /** IP */
    private String registerIp;

    /** ?IP */
    private String loginIp;

    /** ? */
    private Date loginDate;

    /**  */
    private Gender gender;

    /**  */
    private MemberType memberType;

    /**  */
    private Date birth;

    /** ? */
    private String address;

    /**  */
    private String zipCode;

    /** ?(?) */
    private String phone;

    /**  */
    private SafeKey safeKey;

    /**  */
    private Area area;

    /** ?? */
    private Integer validateCodeNumber;

    /** ???? */
    private Boolean isAcceptLeaveInfo;

    // /** ?? -- ????1 */
    // private Boolean isUpdate;

    /**  */
    private DictSchool dictSchool;

    /** ? */
    private Set<Payment> payments = new HashSet<Payment>();

    /** ? */
    private Set<MemberDeviceInfo> memberDeviceInfos = new HashSet<MemberDeviceInfo>();

    /**  */
    private Set<PatriarchStudentMap> patriarchStudentMap = new HashSet<PatriarchStudentMap>();

    /** ?? */
    private Set<ClassTeacherMap> classTeacherMap = new HashSet<ClassTeacherMap>();

    /**  */
    private Set<SystemSuggest> systemSuggests = new HashSet<SystemSuggest>();

    /** ? */
    private Set<Message> inMessages = new HashSet<Message>();

    /** ??? */
    private Set<Message> outMessages = new HashSet<Message>();

    /** ? */
    private Set<TimeCard> timeCards = new HashSet<TimeCard>();

    /** ?? */
    private Set<WorkScheduling> workSchedulings = new HashSet<WorkScheduling>();

    /** ?? */
    private Set<TeacherAttendance> teacherAttendances = new HashSet<TeacherAttendance>();

    /** ? */
    private Set<GrowthDiary> growthDiaries = new HashSet<GrowthDiary>();

    /** ?? */
    private Set<DiaryTranspond> diaryTransponds = new HashSet<DiaryTranspond>();

    /** ? */
    private Set<DiaryComment> diaryComments = new HashSet<DiaryComment>();

    /** ?? */
    private Set<DiaryCollection> diaryCollections = new HashSet<DiaryCollection>();

    /** ? */
    private Set<DiaryAgree> diaryAgrees = new HashSet<DiaryAgree>();

    /** ?At */
    private Set<AtUser> atUsers = new HashSet<AtUser>();

    /** ?? */
    private Set<TeacherAskLeave> teacherAskLeaves = new HashSet<TeacherAskLeave>();

    /** ? */
    private Set<TeacherAskLeave> approvalAskLeaves = new HashSet<TeacherAskLeave>();

    /** app? */
    private Set<AppUser> appUsers = new HashSet<AppUser>();

    /**
     * ???
     * 
     * @return ??
     */
    @JsonProperty
    @NotEmpty(groups = Save.class)
    @Pattern(regexp = "^[0-9a-z_A-Z\\u4e00-\\u9fa5]+$")
    // @Column(nullable = false, updatable = false, unique = true, length =
    // 100)
    @Column(nullable = false, unique = true, length = 100)
    public String getUsername() {
        return username;
    }

    /**
     * ??
     * 
     * @param username ??
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     * ??
     * 
     * @return  signature
     */
    @Length(max = 200)
    @Column(nullable = false)
    public String getSignature() {
        return signature;
    }

    /**
     * ??
     * 
     * @param signature
     */
    public void setSignature(String signature) {
        this.signature = signature;
    }

    /**
     * @return  iconPhoto
     */
    public String getIconPhoto() {
        return iconPhoto;
    }

    /**
     * @param iconPhoto
     */
    public void setIconPhoto(String iconPhoto) {
        this.iconPhoto = iconPhoto;
    }

    /**
     * ??
     * 
     * @return ?
     */
    @NotEmpty(groups = Save.class)
    @Pattern(regexp = "^[^\\s&\"<>]+$")
    @Column(nullable = false)
    public String getPassword() {
        return password;
    }

    /**
     * ?
     * 
     * @param password ?
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * ?E-mail
     * 
     * @return E-mail
     */
    @JsonProperty
    @Email
    @Length(max = 200)
    @Column(nullable = true)
    public String getEmail() {
        return email;
    }

    /**
     * E-mail
     * 
     * @param email E-mail
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * ?
     * 
     * @return 
     */
    @JsonProperty
    @NotNull(groups = Save.class)
    @Min(0)
    @Column(nullable = false)
    public Long getPoint() {
        return point;
    }

    /**
     * 
     * 
     * @param point 
     */
    public void setPoint(Long point) {
        this.point = point;
    }

    /**
     * ???
     * 
     * @return ??
     */
    @NotNull
    @Column(nullable = false)
    public Boolean getIsEnabled() {
        return isEnabled;
    }

    /**
     * ??
     * 
     * @param isEnabled ??
     */
    public void setIsEnabled(Boolean isEnabled) {
        this.isEnabled = isEnabled;
    }

    /**
     * ???
     * 
     * @return ??
     */
    @JsonProperty
    @Column(nullable = false)
    public Boolean getIsLocked() {
        return isLocked;
    }

    /**
     * ??
     * 
     * @param isLocked ??
     */
    public void setIsLocked(Boolean isLocked) {
        this.isLocked = isLocked;
    }

    /**
     * ?
     * 
     * @return 
     */
    @Column(nullable = false)
    public Integer getLoginFailureCount() {
        return loginFailureCount;
    }

    /**
     * 
     * 
     * @param loginFailureCount 
     */
    public void setLoginFailureCount(Integer loginFailureCount) {
        this.loginFailureCount = loginFailureCount;
    }

    /**
     * ??
     * 
     * @return ?
     */
    public Date getLockedDate() {
        return lockedDate;
    }

    /**
     * ?
     * 
     * @param lockedDate ?
     */
    public void setLockedDate(Date lockedDate) {
        this.lockedDate = lockedDate;
    }

    /**
     * ?IP
     * 
     * @return IP
     */
    @Column(nullable = false, updatable = false)
    public String getRegisterIp() {
        return registerIp;
    }

    /**
     * IP
     * 
     * @param registerIp IP
     */
    public void setRegisterIp(String registerIp) {
        this.registerIp = registerIp;
    }

    /**
     * ??IP
     * 
     * @return ?IP
     */
    public String getLoginIp() {
        return loginIp;
    }

    /**
     * ?IP
     * 
     * @param loginIp ?IP
     */
    public void setLoginIp(String loginIp) {
        this.loginIp = loginIp;
    }

    /**
     * 
     * 
     * @param memberType 
     */
    public void setMemberType(MemberType memberType) {
        this.memberType = memberType;
    }

    /**
     * ?
     * 
     * @return 
     */
    public MemberType getMemberType() {
        return memberType;
    }

    /**
     * ??
     * 
     * @return ?
     */
    public Date getLoginDate() {
        return loginDate;
    }

    /**
     * ?
     * 
     * @param loginDate ?
     */
    public void setLoginDate(Date loginDate) {
        this.loginDate = loginDate;
    }

    /**
     * ?
     * 
     * @return 
     */
    @JsonProperty
    public Gender getGender() {
        return gender;
    }

    /**
     * 
     * 
     * @param gender 
     */
    public void setGender(Gender gender) {
        this.gender = gender;
    }

    /**
     * ?
     * 
     * @return 
     */
    @JsonProperty
    public Date getBirth() {
        return birth;
    }

    /**
     * 
     * 
     * @param birth 
     */
    public void setBirth(Date birth) {
        this.birth = birth;
    }

    /**
     * ??
     * 
     * @return ?
     */
    @JsonProperty
    @Length(max = 200)
    public String getAddress() {
        return address;
    }

    /**
     * ?
     * 
     * @param address ?
     */
    public void setAddress(String address) {
        this.address = address;
    }

    /**
     * ?
     * 
     * @return 
     */
    @JsonProperty
    @Length(max = 200)
    public String getZipCode() {
        return zipCode;
    }

    /**
     * 
     * 
     * @param zipCode 
     */
    public void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }

    /**
     * ??
     * 
     * @return ?
     */
    @JsonProperty
    @Length(max = 200)
    public String getPhone() {
        return phone;
    }

    /**
     * ?
     * 
     * @param phone ?
     */
    public void setPhone(String phone) {
        this.phone = phone;
    }

    /**
     * ?
     * 
     * @return 
     */
    @JsonProperty
    @Length(max = 200)
    public String getMobile() {
        return mobile;
    }

    /**
     * 
     * 
     * @param mobile 
     */
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    /**
     * @return  realName
     */
    @JsonProperty
    public String getRealName() {
        return realName;
    }

    /**
     * @param realName
     */
    public void setRealName(String realName) {
        this.realName = realName;
    }

    /**
     * @return  idCard
     */
    public String getIdCard() {
        return idCard;
    }

    /**
     * @param idCard
     */
    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    /**
     * @return  age
     */
    @Transient
    @JsonProperty
    public Integer getAge() {
        return DateUtil.getAge(this.getBirth());
    }

    /**
     * ?
     * 
     * @return 
     */
    @Embedded
    public SafeKey getSafeKey() {
        return safeKey;
    }

    /**
     * 
     * 
     * @param safeKey 
     */
    public void setSafeKey(SafeKey safeKey) {
        this.safeKey = safeKey;
    }

    /**
     * ?
     * 
     * @return 
     */
    @ManyToOne(fetch = FetchType.LAZY)
    public Area getArea() {
        return area;
    }

    /**
     * 
     * 
     * @param area 
     */
    public void setArea(Area area) {
        this.area = area;
    }

    /**
     * ??
     * 
     * @return ?
     */
    @OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<Payment> getPayments() {
        return payments;
    }

    /**
     * ?
     * 
     * @param payments ?
     */
    public void setPayments(Set<Payment> payments) {
        this.payments = payments;
    }

    /**
     * @return  ?
     */
    @OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<MemberDeviceInfo> getMemberDeviceInfos() {
        return memberDeviceInfos;
    }

    /**
     * @param ?
     */
    public void setMemberDeviceInfos(Set<MemberDeviceInfo> memberDeviceInfos) {
        this.memberDeviceInfos = memberDeviceInfos;
    }

    /**
     * @return  
     */
    @OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<PatriarchStudentMap> getPatriarchStudentMap() {
        return patriarchStudentMap;
    }

    /**
     * @param ?
     */
    public void setPatriarchStudentMap(Set<PatriarchStudentMap> patriarchStudentMap) {
        this.patriarchStudentMap = patriarchStudentMap;
    }

    /**
     * @return  
     */
    @NotNull
    @NotFound(action = NotFoundAction.IGNORE)
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(nullable = false)
    public DictSchool getDictSchool() {
        return dictSchool;
    }

    /**
     * @param 
     */
    public void setDictSchool(DictSchool dictSchool) {
        this.dictSchool = dictSchool;
    }

    /**
     * @return ???
     */
    @Column(columnDefinition = "int default 0", nullable = false)
    public Integer getValidateCodeNumber() {
        return validateCodeNumber;
    }

    /**
     * @param validateCodeNumber ???
     */
    public void setValidateCodeNumber(Integer validateCodeNumber) {
        this.validateCodeNumber = validateCodeNumber;
    }

    /**
     * ???
     * 
     * @return isAcceptLeaveInfo
     * @see [?#?#?]
     */
    public Boolean getIsAcceptLeaveInfo() {
        return isAcceptLeaveInfo;
    }

    /**
     * @param isAcceptLeaveInfo ???
     */
    public void setIsAcceptLeaveInfo(Boolean isAcceptLeaveInfo) {
        this.isAcceptLeaveInfo = isAcceptLeaveInfo;
    }

    // /**
    // * @return isUpdate
    // */
    // public Boolean getIsUpdate()
    // {
    // return isUpdate;
    // }
    //
    // /**
    // * @param isUpdate
    // */
    // public void setIsUpdate(Boolean isUpdate)
    // {
    // this.isUpdate = isUpdate;
    // }

    /**
     * @return ClassTeacherMap
     */
    @OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<ClassTeacherMap> getClassTeacherMap() {
        return classTeacherMap;
    }

    /**
     * @param classTeacherMap
     */
    public void setClassTeacherMap(Set<ClassTeacherMap> classTeacherMap) {
        this.classTeacherMap = classTeacherMap;
    }

    /**
     * @return  systemSuggests
     */
    @OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<SystemSuggest> getSystemSuggests() {
        return systemSuggests;
    }

    /**
     * @param systemSuggests
     */
    public void setSystemSuggests(Set<SystemSuggest> systemSuggests) {
        this.systemSuggests = systemSuggests;
    }

    /**
     * @return  timeCards
     */
    @OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<TimeCard> getTimeCards() {
        return timeCards;
    }

    /**
     * @param timeCards
     */
    public void setTimeCards(Set<TimeCard> timeCards) {
        this.timeCards = timeCards;
    }

    /**
     * @return ?
     */
    @OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<WorkScheduling> getWorkSchedulings() {
        return workSchedulings;
    }

    /**
     * @param workSchedulings
     */
    public void setWorkSchedulings(Set<WorkScheduling> workSchedulings) {
        this.workSchedulings = workSchedulings;
    }

    /**
     * ????
     * 
     * @return ???
     */
    @OneToMany(mappedBy = "sender", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<Message> getOutMessages() {
        return outMessages;
    }

    /**
     * ???
     * 
     * @param outMessages ???
     */
    public void setOutMessages(Set<Message> outMessages) {
        this.outMessages = outMessages;
    }

    /**
     * ??
     * 
     * @return ?
     */
    @OneToMany(mappedBy = "receiver", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<Message> getInMessages() {
        return inMessages;
    }

    /**
     * ?
     * 
     * @param inMessages ?
     */
    public void setInMessages(Set<Message> inMessages) {
        this.inMessages = inMessages;
    }

    /**
     * ?
     * 
     * @return teacherAttendances
     * @see [?#?#?]
     */
    @OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<TeacherAttendance> getTeacherAttendances() {
        return teacherAttendances;
    }

    /**
     * 
     * 
     * @param teacherAttendances
     * @see [?#?#?]
     */
    public void setTeacherAttendances(Set<TeacherAttendance> teacherAttendances) {
        this.teacherAttendances = teacherAttendances;
    }

    /**
     * ??
     * 
     * @return growthDiaries
     * @see [?#?#?]
     */
    @OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<GrowthDiary> getGrowthDiaries() {
        return growthDiaries;
    }

    /**
     * ?
     * 
     * @param growthDiaries
     * @see [?#?#?]
     */
    public void setGrowthDiaries(Set<GrowthDiary> growthDiaries) {
        this.growthDiaries = growthDiaries;
    }

    /**
     * ???
     * 
     * @return diaryTransponds
     * @see [?#?#?]
     */
    @OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<DiaryTranspond> getDiaryTransponds() {
        return diaryTransponds;
    }

    /**
     * ??
     * 
     * @param diaryTransponds
     * @see [?#?#?]
     */
    public void setDiaryTransponds(Set<DiaryTranspond> diaryTransponds) {
        this.diaryTransponds = diaryTransponds;
    }

    /**
     * ??
     * 
     * @return diaryComments
     * @see [?#?#?]
     */
    @OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<DiaryComment> getDiaryComments() {
        return diaryComments;
    }

    /**
     * ?
     * 
     * @param diaryComments
     * @see [?#?#?]
     */
    public void setDiaryComments(Set<DiaryComment> diaryComments) {
        this.diaryComments = diaryComments;
    }

    /**
     * ???
     * 
     * @return diaryCollections
     * @see [?#?#?]
     */
    @OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<DiaryCollection> getDiaryCollections() {
        return diaryCollections;
    }

    /**
     * ??
     * 
     * @param diaryComments
     * @see [?#?#?]
     */
    public void setDiaryCollections(Set<DiaryCollection> diaryCollections) {
        this.diaryCollections = diaryCollections;
    }

    /**
     * ??
     * 
     * @return diaryAgrees
     * @see [?#?#?]
     */
    @OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<DiaryAgree> getDiaryAgrees() {
        return diaryAgrees;
    }

    /**
     * ?
     * 
     * @param diaryAgrees
     * @see [?#?#?]
     */
    public void setDiaryAgrees(Set<DiaryAgree> diaryAgrees) {
        this.diaryAgrees = diaryAgrees;
    }

    /**
     * ??AT
     * 
     * @return atUsers
     * @see [?#?#?]
     */
    @OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<AtUser> getAtUsers() {
        return atUsers;
    }

    /**
     * ?AT
     * 
     * @param atUsers
     * @see [?#?#?]
     */
    public void setAtUsers(Set<AtUser> atUsers) {
        this.atUsers = atUsers;
    }

    /**
     * ???
     * 
     * @return
     * @see [?#?#?]
     */
    @OneToMany(mappedBy = "leaveMember", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<TeacherAskLeave> getTeacherAskLeaves() {
        return teacherAskLeaves;
    }

    /**
     * @param teacherAskLeave
     */
    public void setTeacherAskLeaves(Set<TeacherAskLeave> teacherAskLeaves) {
        this.teacherAskLeaves = teacherAskLeaves;
    }

    /**
     * @return  approvalAskLeaves
     */
    @OneToMany(mappedBy = "approvalMember", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<TeacherAskLeave> getApprovalAskLeaves() {
        return approvalAskLeaves;
    }

    /**
     * @param approvalAskLeaves
     */
    public void setApprovalAskLeaves(Set<TeacherAskLeave> approvalAskLeaves) {
        this.approvalAskLeaves = approvalAskLeaves;
    }

    /**
     * @return  appUsers
     */
    @OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<AppUser> getAppUsers() {
        return appUsers;
    }

    /**
     * @param appUsers
     */
    public void setAppUsers(Set<AppUser> appUsers) {
        this.appUsers = appUsers;
    }

    /**
     * ?
     * 
     * @param memberAttribute 
     * @return 
     */
    @Transient
    public Object getAttributeValue(MemberAttribute memberAttribute) {
        if (memberAttribute != null) {
            if (memberAttribute.getType() == Type.gender) {
                return getGender();
            } else if (memberAttribute.getType() == Type.birth) {
                return getBirth();
            } else if (memberAttribute.getType() == Type.area) {
                return getArea();
            } else if (memberAttribute.getType() == Type.address) {
                return getAddress();
            } else if (memberAttribute.getType() == Type.zipCode) {
                return getZipCode();
            } else if (memberAttribute.getType() == Type.phone) {
                return getPhone();
            } else if (memberAttribute.getType() == Type.mobile) {
                return getMobile();
            } else if (memberAttribute.getType() == Type.height) {
                return getMobile();
            } else if (memberAttribute.getType() == Type.weight) {
                return getMobile();
            } else if (memberAttribute.getType() == Type.checkbox) {
                if (memberAttribute.getPropertyIndex() != null) {
                    try {
                        String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                                + memberAttribute.getPropertyIndex();
                        String propertyValue = (String) PropertyUtils.getProperty(this, propertyName);
                        if (propertyValue != null) {
                            return JsonUtils.toObject(propertyValue, List.class);
                        }
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    } catch (InvocationTargetException e) {
                        e.printStackTrace();
                    } catch (NoSuchMethodException e) {
                        e.printStackTrace();
                    }
                }
            } else {
                if (memberAttribute.getPropertyIndex() != null) {
                    try {
                        String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                                + memberAttribute.getPropertyIndex();
                        return (String) PropertyUtils.getProperty(this, propertyName);
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    } catch (InvocationTargetException e) {
                        e.printStackTrace();
                    } catch (NoSuchMethodException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
        return null;
    }

    /**
     * 
     * 
     * @param memberAttribute 
     * @param attributeValue 
     */
    @Transient
    public void setAttributeValue(MemberAttribute memberAttribute, Object attributeValue) {
        if (memberAttribute != null) {
            if (attributeValue instanceof String && StringUtils.isEmpty((String) attributeValue)) {
                attributeValue = null;
            } else if (memberAttribute.getType() == Type.gender
                    && (attributeValue instanceof Gender || attributeValue == null)) {
                setGender((Gender) attributeValue);
            } else if (memberAttribute.getType() == Type.birth
                    && (attributeValue instanceof Date || attributeValue == null)) {
                setBirth((Date) attributeValue);
            } else if (memberAttribute.getType() == Type.area
                    && (attributeValue instanceof Area || attributeValue == null)) {
                setArea((Area) attributeValue);
            } else if (memberAttribute.getType() == Type.address
                    && (attributeValue instanceof String || attributeValue == null)) {
                setAddress((String) attributeValue);
            } else if (memberAttribute.getType() == Type.zipCode
                    && (attributeValue instanceof String || attributeValue == null)) {
                setZipCode((String) attributeValue);
            } else if (memberAttribute.getType() == Type.phone
                    && (attributeValue instanceof String || attributeValue == null)) {
                setPhone((String) attributeValue);
            } else if (memberAttribute.getType() == Type.mobile
                    && (attributeValue instanceof String || attributeValue == null)) {
                setMobile((String) attributeValue);
            } else if (memberAttribute.getType() == Type.checkbox
                    && (attributeValue instanceof List || attributeValue == null)) {
                if (memberAttribute.getPropertyIndex() != null) {
                    if (attributeValue == null || (memberAttribute.getOptions() != null
                            && memberAttribute.getOptions().containsAll((List<?>) attributeValue))) {
                        try {
                            String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                                    + memberAttribute.getPropertyIndex();
                            PropertyUtils.setProperty(this, propertyName, JsonUtils.toJson(attributeValue));
                        } catch (IllegalAccessException e) {
                            e.printStackTrace();
                        } catch (InvocationTargetException e) {
                            e.printStackTrace();
                        } catch (NoSuchMethodException e) {
                            e.printStackTrace();
                        }
                    }
                }
            } else {
                if (memberAttribute.getPropertyIndex() != null) {
                    try {
                        String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                                + memberAttribute.getPropertyIndex();
                        PropertyUtils.setProperty(this, propertyName, attributeValue);
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    } catch (InvocationTargetException e) {
                        e.printStackTrace();
                    } catch (NoSuchMethodException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }

    /**
     * 
     */
    @Transient
    public void removeAttributeValue() {
        setGender(null);
        setBirth(null);
        setArea(null);
        setAddress(null);
        setZipCode(null);
        setPhone(null);
        setMobile(null);
        for (int i = 0; i < ATTRIBUTE_VALUE_PROPERTY_COUNT; i++) {
            String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX + i;
            try {
                PropertyUtils.setProperty(this, propertyName, null);
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * ??
     * 
     * @return ?
     */
    @JsonProperty
    @Transient
    public boolean getIsDevice() {
        if (getMemberDeviceInfos() != null && getMemberDeviceInfos().size() != 0) {
            return true;
        } else {
            return false;
        }

    }

}