resource.java

来自「anewssystem新闻发布系统集成使用了spring hibernate f」· Java 代码 · 共 176 行

JAVA
176
字号
package anni.asecurity.domain;

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

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import anni.core.grid.LongGridBean;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;


/**
 * Resource generated by Lingo.
 *
 * @author Lingo
 * @since 2007年08月18日 下午 20时18分45秒0
 */
@Entity
@Table(name = "A_SECURITY_RESOURCE")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Resource extends LongGridBean {
    /** * serial. */
    static final long serialVersionUID = 0L;

    /** * id. */
    private Long id;

    /** * name. */
    private String name;

    /** * resType. */
    private String resType;

    /** * resString. */
    private String resString;

    /** * descn. */
    private String descn;

    /** * roles. */
    private Set<Role> roles = new HashSet<Role>(0);

    // ----------------------------------------------------
    // transient fields
    // ----------------------------------------------------
    /** * 是否授权. */
    private Boolean authorized;

    // ----------------------------------------------------
    // constructors
    // ----------------------------------------------------
    /** * empty contructor. */
    public Resource() {
    }

    /**
     * full contructor.
     * @param name String
     * @param resType String
     * @param resString String
     * @param descn String
     */
    public Resource(String name, String resType, String resString,
        String descn) {
        this.name = name;
        this.resType = resType;
        this.resString = resString;
        this.descn = descn;
    }

    /** * @return id. */
    @GenericGenerator(name = "generator", strategy = "increment")
    @Id
    @GeneratedValue(generator = "generator")
    @Column(name = "ID", unique = true, nullable = false)
    public Long getId() {
        return id;
    }

    /** * @param id id. */
    public void setId(Long id) {
        this.id = id;
    }

    /** * @return name. */
    @Column(name = "NAME", length = 50)
    public String getName() {
        return name;
    }

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

    /** * @return resType. */
    @Column(name = "RES_TYPE", length = 50)
    public String getResType() {
        return resType;
    }

    /** * @param resType resType. */
    public void setResType(String resType) {
        this.resType = resType;
    }

    /** * @return resString. */
    @Column(name = "RES_STRING", length = 200)
    public String getResString() {
        return resString;
    }

    /** * @param resString resString. */
    public void setResString(String resString) {
        this.resString = resString;
    }

    /** * @return descn. */
    @Column(name = "DESCN", length = 200)
    public String getDescn() {
        return descn;
    }

    /** * @param descn descn. */
    public void setDescn(String descn) {
        this.descn = descn;
    }

    /** * @return roles. */
    @ManyToMany(cascade =  {
        CascadeType.PERSIST, CascadeType.MERGE}
    , fetch = FetchType.LAZY)
    @JoinTable(name = "A_SECURITY_RESOURCE_ROLE", joinColumns =  {
        @JoinColumn(name = "RESOURCE_ID")
    }
    , inverseJoinColumns =  {
        @JoinColumn(name = "ROLE_ID")
    }
    )
    public Set<Role> getRoles() {
        return roles;
    }

    /** * @param roles roles. */
    public void setRoles(Set<Role> roles) {
        this.roles = roles;
    }

    // ----------------------------------------------------
    // transient methods
    // ----------------------------------------------------
    /** * @return is authorized. */
    @Transient
    public Boolean getAuthorized() {
        return authorized;
    }

    /** * @param authorized is authorized. */
    public void setAuthorized(Boolean authorized) {
        this.authorized = authorized;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?