/*
 * 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.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.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.TLOGHEADER")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tlogheader.findAll", query = "SELECT t FROM Tlogheader t"),
    @NamedQuery(name = "Tlogheader.findByJournalid", query = "SELECT t FROM Tlogheader t WHERE t.journalid = :journalid"),
    @NamedQuery(name = "Tlogheader.findByAccountingdate", query = "SELECT t FROM Tlogheader t WHERE t.accountingdate = :accountingdate"),
    @NamedQuery(name = "Tlogheader.findByTransactionmodule", query = "SELECT t FROM Tlogheader t WHERE t.transactionmodule = :transactionmodule"),
    @NamedQuery(name = "Tlogheader.findByTransactioncode", query = "SELECT t FROM Tlogheader t WHERE t.transactioncode = :transactioncode"),
    @NamedQuery(name = "Tlogheader.findByTransactionversion", query = "SELECT t FROM Tlogheader t WHERE t.transactionversion = :transactionversion"),
    @NamedQuery(name = "Tlogheader.findByRealdate", query = "SELECT t FROM Tlogheader t WHERE t.realdate = :realdate"),
    @NamedQuery(name = "Tlogheader.findByCompanycode", query = "SELECT t FROM Tlogheader t WHERE t.companycode = :companycode"),
    @NamedQuery(name = "Tlogheader.findByBranchcode", query = "SELECT t FROM Tlogheader t WHERE t.branchcode = :branchcode"),
    @NamedQuery(name = "Tlogheader.findByOfficecode", query = "SELECT t FROM Tlogheader t WHERE t.officecode = :officecode"),
    @NamedQuery(name = "Tlogheader.findByUsercode", query = "SELECT t FROM Tlogheader t WHERE t.usercode = :usercode"),
    @NamedQuery(name = "Tlogheader.findByAditionaldata", query = "SELECT t FROM Tlogheader t WHERE t.aditionaldata = :aditionaldata")})
public class Tlogheader implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "JOURNALID")
    private String journalid;
    @Column(name = "ACCOUNTINGDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date accountingdate;
    @Basic(optional = false)
    @Column(name = "TRANSACTIONMODULE")
    private String transactionmodule;
    @Basic(optional = false)
    @Column(name = "TRANSACTIONCODE")
    private short transactioncode;
    @Basic(optional = false)
    @Column(name = "TRANSACTIONVERSION")
    private short transactionversion;
    @Column(name = "REALDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date realdate;
    @Column(name = "COMPANYCODE")
    private Long companycode;
    @Column(name = "BRANCHCODE")
    private Short branchcode;
    @Column(name = "OFFICECODE")
    private Short officecode;
    @Column(name = "USERCODE")
    private String usercode;
    @Column(name = "ADITIONALDATA")
    private String aditionaldata;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tlogheader")
    private Collection<Tlogload> tlogloadCollection;

    public Tlogheader() {
    }

    public Tlogheader(String journalid) {
        this.journalid = journalid;
    }

    public Tlogheader(String journalid, String transactionmodule, short transactioncode, short transactionversion) {
        this.journalid = journalid;
        this.transactionmodule = transactionmodule;
        this.transactioncode = transactioncode;
        this.transactionversion = transactionversion;
    }

    public String getJournalid() {
        return journalid;
    }

    public void setJournalid(String journalid) {
        this.journalid = journalid;
    }

    public Date getAccountingdate() {
        return accountingdate;
    }

    public void setAccountingdate(Date accountingdate) {
        this.accountingdate = accountingdate;
    }

    public String getTransactionmodule() {
        return transactionmodule;
    }

    public void setTransactionmodule(String transactionmodule) {
        this.transactionmodule = transactionmodule;
    }

    public short getTransactioncode() {
        return transactioncode;
    }

    public void setTransactioncode(short transactioncode) {
        this.transactioncode = transactioncode;
    }

    public short getTransactionversion() {
        return transactionversion;
    }

    public void setTransactionversion(short transactionversion) {
        this.transactionversion = transactionversion;
    }

    public Date getRealdate() {
        return realdate;
    }

    public void setRealdate(Date realdate) {
        this.realdate = realdate;
    }

    public Long getCompanycode() {
        return companycode;
    }

    public void setCompanycode(Long companycode) {
        this.companycode = companycode;
    }

    public Short getBranchcode() {
        return branchcode;
    }

    public void setBranchcode(Short branchcode) {
        this.branchcode = branchcode;
    }

    public Short getOfficecode() {
        return officecode;
    }

    public void setOfficecode(Short officecode) {
        this.officecode = officecode;
    }

    public String getUsercode() {
        return usercode;
    }

    public void setUsercode(String usercode) {
        this.usercode = usercode;
    }

    public String getAditionaldata() {
        return aditionaldata;
    }

    public void setAditionaldata(String aditionaldata) {
        this.aditionaldata = aditionaldata;
    }

    @XmlTransient
    public Collection<Tlogload> getTlogloadCollection() {
        return tlogloadCollection;
    }

    public void setTlogloadCollection(Collection<Tlogload> tlogloadCollection) {
        this.tlogloadCollection = tlogloadCollection;
    }

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

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