/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rjconsultores.ventaboletos.entidad;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author rodrigo
 */
@Entity
@Table(name = "FUNCION_SISTEMA")
@SequenceGenerator(name = "FUNCION_SISTEMA_SEQ", sequenceName = "FUNCION_SISTEMA_SEQ", allocationSize = 1)
public class FuncionSistema implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "FUNCIONSISTEMA_ID")
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "FUNCION_SISTEMA_SEQ")
    private Integer funcionsistemaId;
    @Column(name = "NOMBFUNCION")
    private String nombfuncion;
    @Column(name = "DESCRUTA")
    private String descruta;
    @Column(name = "ACTIVO")
    private Boolean activo;
    @Column(name = "FECMODIF")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecmodif;
    @Column(name = "USUARIO_ID")
    private Integer usuarioId;
    @OneToMany(mappedBy = "funcionSistema")
    private List<PerfilFuncion> perfilFuncionList;
    @JoinColumn(name = "SISTEMA_ID", referencedColumnName = "SISTEMA_ID")
    @ManyToOne
    private Sistema sistema;

    public FuncionSistema() {
    }

    public FuncionSistema(Integer funcionsistemaId) {
        this.funcionsistemaId = funcionsistemaId;
    }

    public Integer getFuncionsistemaId() {
        return funcionsistemaId;
    }

    public void setFuncionsistemaId(Integer funcionsistemaId) {
        this.funcionsistemaId = funcionsistemaId;
    }

    public String getNombfuncion() {
        return nombfuncion;
    }

    public void setNombfuncion(String nombfuncion) {
        this.nombfuncion = nombfuncion;
    }

    public String getDescruta() {
        return descruta;
    }

    public void setDescruta(String descruta) {
        this.descruta = descruta;
    }

    public Boolean getActivo() {
        return activo;
    }

    public void setActivo(Boolean activo) {
        this.activo = activo;
    }

    public Date getFecmodif() {
        return fecmodif;
    }

    public void setFecmodif(Date fecmodif) {
        this.fecmodif = fecmodif;
    }

    public Integer getUsuarioId() {
        return usuarioId;
    }

    public void setUsuarioId(Integer usuarioId) {
        this.usuarioId = usuarioId;
    }

    public List<PerfilFuncion> getPerfilFuncionList() {
        return perfilFuncionList;
    }

    public void setPerfilFuncionList(List<PerfilFuncion> perfilFuncionList) {
        this.perfilFuncionList = perfilFuncionList;
    }

    public Sistema getSistema() {
        return sistema;
    }

    public void setSistema(Sistema sistema) {
        this.sistema = sistema;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (funcionsistemaId != null ? funcionsistemaId.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 FuncionSistema)) {
            return false;
        }
        FuncionSistema other = (FuncionSistema) object;
        if ((this.funcionsistemaId == null && other.funcionsistemaId != null) || (this.funcionsistemaId != null && !this.funcionsistemaId.equals(other.funcionsistemaId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return getNombfuncion();
    }
}
