All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.n2oapp.security.admin.impl.entity.RoleEntity Maven / Gradle / Ivy

There is a newer version: 8.0.1
Show newest version
package net.n2oapp.security.admin.impl.entity;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import net.n2oapp.security.admin.api.model.UserLevel;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * Сущность Роль
 */
@Entity
@Getter
@Setter
@NoArgsConstructor
@Table(name = "role", schema = "sec")
public class RoleEntity {
    /**
     * Идентификатор роли
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    private Integer id;

    /**
     * Наименование роли
     */
    @NotNull
    @Column(name = "name", nullable = false)
    private String name;

    /**
     * Код роли
     */
    @Column(name = "code")
    private String code;

    /**
     * Описание роли
     */
    @Column(name = "description")
    private String description;

    /**
     * Уровень пользователя, для которого предназначена роль
     */
    @Column(name = "user_level")
    @Enumerated(EnumType.STRING)
    private UserLevel userLevel;

    /**
     * Прикладная система (подсистема, модуль), которой принадлежит роль
     */
    @JoinColumn(name = "system_code")
    @ManyToOne(fetch = FetchType.EAGER)
    private SystemEntity systemCode;

    /**
     * Права доступа роли
     */
    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "role_permission", schema = "sec",
            joinColumns = {@JoinColumn(name = "role_id")},
            inverseJoinColumns = {@JoinColumn(name = "permission_code")}
    )
    private List permissionList;

    @ManyToMany(mappedBy = "roleList")
    private List accountList;

    @OneToMany(mappedBy = "id.role")
    private List accountTypeRoleList;

    public RoleEntity(Integer id) {
        setId(id);
    }


}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy