com.iterzp.momo.entity.Role.java Source code

Java tutorial

Introduction

Here is the source code for com.iterzp.momo.entity.Role.java

Source

/*
 * Copyright 2005-2013 shopxx.net. All rights reserved.
 * Support: http://www.shopxx.net
 * License: http://www.shopxx.net/license
 */
package com.iterzp.momo.entity;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Entity - 
 * @author canfly
 * @version 1.0
 */
@Entity
@Table(name = "tb_role")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "momo_role_sequence")
public class Role extends BaseEntity {

    private static final long serialVersionUID = -6614052029623997372L;

    /**
     * ?
     */
    public enum OwnType {
        /**  */
        hotel
    }

    /**  */
    @JsonProperty
    private OwnType ownType;

    /** ?? */
    private String name;

    /** ? */
    private Boolean isSystem;

    /** ?? */
    private String description;

    /** ?? */
    private List<String> authorities = new ArrayList<String>();

    /** ? */
    private Set<Member> members = new HashSet<Member>();

    /**
     * ???
     * 
     * @return ??
     */
    @NotEmpty
    @Length(max = 200)
    @Column(nullable = false)
    public String getName() {
        return name;
    }

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

    /**
     * ??
     * 
     * @return ?
     */
    @Column(nullable = false, updatable = false)
    public Boolean getIsSystem() {
        return isSystem;
    }

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

    /**
     * ???
     * 
     * @return ??
     */
    @Length(max = 200)
    public String getDescription() {
        return description;
    }

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

    /**
     * ???
     * 
     * @return ??
     */
    @ElementCollection
    @CollectionTable(name = "tb_role_authority")
    public List<String> getAuthorities() {
        return authorities;
    }

    /**
     * ??
     * 
     * @param authorities
     *            ??
     */
    public void setAuthorities(List<String> authorities) {
        this.authorities = authorities;
    }

    /**
     * ?
     * 
     * @return ?
     */
    @ManyToMany(mappedBy = "roles", fetch = FetchType.LAZY)
    public Set<Member> getMembers() {
        return members;
    }

    /**
     * ?
     * 
     * @param members
     *            ?
     */
    public void setMembers(Set<Member> members) {
        this.members = members;
    }

    /**
     * ?
     * 
     * @return 
     */
    public OwnType getOwnType() {
        return ownType;
    }

    /**
     * 
     * 
     * @param ownType
     *            
     */
    public void setOwnType(OwnType ownType) {
        this.ownType = ownType;
    }

}