/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.qsoft.rs.sincoar.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.MD_PRIVILEGES")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MdPrivileges.findAll", query = "SELECT m FROM MdPrivileges m"),
    @NamedQuery(name = "MdPrivileges.findById", query = "SELECT m FROM MdPrivileges m WHERE m.id = :id"),
    @NamedQuery(name = "MdPrivileges.findByPrivilegeName", query = "SELECT m FROM MdPrivileges m WHERE m.privilegeName = :privilegeName"),
    @NamedQuery(name = "MdPrivileges.findByPrivelegeObjectId", query = "SELECT m FROM MdPrivileges m WHERE m.privelegeObjectId = :privelegeObjectId"),
    @NamedQuery(name = "MdPrivileges.findByPrivelegeobjecttype", query = "SELECT m FROM MdPrivileges m WHERE m.privelegeobjecttype = :privelegeobjecttype"),
    @NamedQuery(name = "MdPrivileges.findByPrivelegeType", query = "SELECT m FROM MdPrivileges m WHERE m.privelegeType = :privelegeType"),
    @NamedQuery(name = "MdPrivileges.findByAdminOption", query = "SELECT m FROM MdPrivileges m WHERE m.adminOption = :adminOption"),
    @NamedQuery(name = "MdPrivileges.findByNativeKey", query = "SELECT m FROM MdPrivileges m WHERE m.nativeKey = :nativeKey"),
    @NamedQuery(name = "MdPrivileges.findByComments", query = "SELECT m FROM MdPrivileges m WHERE m.comments = :comments"),
    @NamedQuery(name = "MdPrivileges.findBySecurityGroupId", query = "SELECT m FROM MdPrivileges m WHERE m.securityGroupId = :securityGroupId"),
    @NamedQuery(name = "MdPrivileges.findByCreatedOn", query = "SELECT m FROM MdPrivileges m WHERE m.createdOn = :createdOn"),
    @NamedQuery(name = "MdPrivileges.findByCreatedBy", query = "SELECT m FROM MdPrivileges m WHERE m.createdBy = :createdBy"),
    @NamedQuery(name = "MdPrivileges.findByLastUpdatedOn", query = "SELECT m FROM MdPrivileges m WHERE m.lastUpdatedOn = :lastUpdatedOn"),
    @NamedQuery(name = "MdPrivileges.findByLastUpdatedBy", query = "SELECT m FROM MdPrivileges m WHERE m.lastUpdatedBy = :lastUpdatedBy")})
public class MdPrivileges implements Serializable {

    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private BigDecimal id;
    @Basic(optional = false)
    @Column(name = "PRIVILEGE_NAME")
    private String privilegeName;
    @Column(name = "PRIVELEGE_OBJECT_ID")
    private BigInteger privelegeObjectId;
    @Basic(optional = false)
    @Column(name = "PRIVELEGEOBJECTTYPE")
    private String privelegeobjecttype;
    @Basic(optional = false)
    @Column(name = "PRIVELEGE_TYPE")
    private String privelegeType;
    @Column(name = "ADMIN_OPTION")
    private Character adminOption;
    @Basic(optional = false)
    @Lob
    @Column(name = "NATIVE_SQL")
    private String nativeSql;
    @Column(name = "NATIVE_KEY")
    private String nativeKey;
    @Column(name = "COMMENTS")
    private String comments;
    @Basic(optional = false)
    @Column(name = "SECURITY_GROUP_ID")
    private BigInteger securityGroupId;
    @Basic(optional = false)
    @Column(name = "CREATED_ON")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createdOn;
    @Column(name = "CREATED_BY")
    private String createdBy;
    @Column(name = "LAST_UPDATED_ON")
    @Temporal(TemporalType.TIMESTAMP)
    private Date lastUpdatedOn;
    @Column(name = "LAST_UPDATED_BY")
    private String lastUpdatedBy;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "privilegeIdFk")
    private Collection<MdGroupPrivileges> mdGroupPrivilegesCollection;
    @JoinColumn(name = "SCHEMA_ID_FK", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private MdSchemas schemaIdFk;
    @OneToMany(mappedBy = "privilegeIdFk")
    private Collection<MdUserPrivileges> mdUserPrivilegesCollection;

    public MdPrivileges() {
    }

    public MdPrivileges(BigDecimal id) {
        this.id = id;
    }

    public MdPrivileges(BigDecimal id, String privilegeName, String privelegeobjecttype, String privelegeType, String nativeSql, BigInteger securityGroupId, Date createdOn) {
        this.id = id;
        this.privilegeName = privilegeName;
        this.privelegeobjecttype = privelegeobjecttype;
        this.privelegeType = privelegeType;
        this.nativeSql = nativeSql;
        this.securityGroupId = securityGroupId;
        this.createdOn = createdOn;
    }

    public BigDecimal getId() {
        return id;
    }

    public void setId(BigDecimal id) {
        this.id = id;
    }

    public String getPrivilegeName() {
        return privilegeName;
    }

    public void setPrivilegeName(String privilegeName) {
        this.privilegeName = privilegeName;
    }

    public BigInteger getPrivelegeObjectId() {
        return privelegeObjectId;
    }

    public void setPrivelegeObjectId(BigInteger privelegeObjectId) {
        this.privelegeObjectId = privelegeObjectId;
    }

    public String getPrivelegeobjecttype() {
        return privelegeobjecttype;
    }

    public void setPrivelegeobjecttype(String privelegeobjecttype) {
        this.privelegeobjecttype = privelegeobjecttype;
    }

    public String getPrivelegeType() {
        return privelegeType;
    }

    public void setPrivelegeType(String privelegeType) {
        this.privelegeType = privelegeType;
    }

    public Character getAdminOption() {
        return adminOption;
    }

    public void setAdminOption(Character adminOption) {
        this.adminOption = adminOption;
    }

    public String getNativeSql() {
        return nativeSql;
    }

    public void setNativeSql(String nativeSql) {
        this.nativeSql = nativeSql;
    }

    public String getNativeKey() {
        return nativeKey;
    }

    public void setNativeKey(String nativeKey) {
        this.nativeKey = nativeKey;
    }

    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }

    public BigInteger getSecurityGroupId() {
        return securityGroupId;
    }

    public void setSecurityGroupId(BigInteger securityGroupId) {
        this.securityGroupId = securityGroupId;
    }

    public Date getCreatedOn() {
        return createdOn;
    }

    public void setCreatedOn(Date createdOn) {
        this.createdOn = createdOn;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public Date getLastUpdatedOn() {
        return lastUpdatedOn;
    }

    public void setLastUpdatedOn(Date lastUpdatedOn) {
        this.lastUpdatedOn = lastUpdatedOn;
    }

    public String getLastUpdatedBy() {
        return lastUpdatedBy;
    }

    public void setLastUpdatedBy(String lastUpdatedBy) {
        this.lastUpdatedBy = lastUpdatedBy;
    }

    @XmlTransient
    public Collection<MdGroupPrivileges> getMdGroupPrivilegesCollection() {
        return mdGroupPrivilegesCollection;
    }

    public void setMdGroupPrivilegesCollection(Collection<MdGroupPrivileges> mdGroupPrivilegesCollection) {
        this.mdGroupPrivilegesCollection = mdGroupPrivilegesCollection;
    }

    public MdSchemas getSchemaIdFk() {
        return schemaIdFk;
    }

    public void setSchemaIdFk(MdSchemas schemaIdFk) {
        this.schemaIdFk = schemaIdFk;
    }

    @XmlTransient
    public Collection<MdUserPrivileges> getMdUserPrivilegesCollection() {
        return mdUserPrivilegesCollection;
    }

    public void setMdUserPrivilegesCollection(Collection<MdUserPrivileges> mdUserPrivilegesCollection) {
        this.mdUserPrivilegesCollection = mdUserPrivilegesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MdPrivileges)) {
            return false;
        }
        MdPrivileges other = (MdPrivileges) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.qsoft.rs.sincoar.model.MdPrivileges[ id=" + id + " ]";
    }
    
}
