Subversion Repositories Integrator Subversion

Rev

Rev 477 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

package br.com.ec.domain.model;

import java.io.Serializable;

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.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.ForeignKey;

import br.com.ec.core.interfaces.Alterar;
import br.com.ec.core.interfaces.Cadastrar;
import br.com.ec.core.util.VerificadorUtil;

@Entity
@Table(name="sec_transporte", schema="sc_sec")
public class Transporte implements Serializable {

        private static final long serialVersionUID = 1L;

        private Long sequencial;
        private String codigoModalidadeFrete;
        private Integer quantidade;
        private String volumeEspecie;
        private Double pesoBruto;
        private Double pesoLiquido;
       
//      private String marca;
//      private String numeracao;
       
        private Transportadora transportadora;
//      private String nome;
//      private String codigoANTT;     
//      private String placaVeiculo;
//      private String ufVeiculo;
//      private String cnpjCpfTransportadora;
//      private String enderecoTransportadora;
//      private String municipioTransportadora;
//      private String ufTransportadora;
//      private String inscricaoEstadualTransportadora;
       
       
        @Id
        @SequenceGenerator(name = "sq_transporte")
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Column(name="seq_transporte", nullable=false)
        public Long getSequencial() {
                return sequencial;
        }
        public void setSequencial(Long sequencial) {
                this.sequencial = sequencial;
        }
       
        @NotNull(message = "Parâmetro obrigatório não preenchido: Modalidade do frete", groups = {Cadastrar.class, Alterar.class})
        @Column(name="cod_modalidade_frete")
        public String getCodigoModalidadeFrete() {
                return codigoModalidadeFrete;
        }
        public void setCodigoModalidadeFrete(String codigoModalidadeFrete) {
                this.codigoModalidadeFrete = codigoModalidadeFrete;
        }
       
        @NotNull(message = "Parâmetro obrigatório não preenchido: Quantidade do volume", groups = {Cadastrar.class, Alterar.class})
        @Column(name="qtd_volume")
        public Integer getQuantidade() {
                return quantidade;
        }
        public void setQuantidade(Integer quantidade) {
                this.quantidade = quantidade;
        }
       
        @NotNull(message = "Parâmetro obrigatório não preenchido: Descrição do volume", groups = {Cadastrar.class, Alterar.class})
        @Column(name="dsc_volume")
        public String getVolumeEspecie() {
                return volumeEspecie;
        }
        public void setVolumeEspecie(String volumeEspecie) {
                this.volumeEspecie = volumeEspecie;
        }
       
        @NotNull(message = "Parâmetro obrigatório não preenchido: Peso bruto", groups = {Cadastrar.class, Alterar.class})
        @Column(name="val_peso_bruto")
        public Double getPesoBruto() {
                return pesoBruto;
        }
        public void setPesoBruto(Double pesoBruto) {
                this.pesoBruto = pesoBruto;
        }
       
        @NotNull(message = "Parâmetro obrigatório não preenchido: Peso líquido", groups = {Cadastrar.class, Alterar.class})
        @Column(name="val_peso_liquido")
        public Double getPesoLiquido() {
                return pesoLiquido;
        }
        public void setPesoLiquido(Double pesoLiquido) {
                this.pesoLiquido = pesoLiquido;
        }
       
        @ManyToOne
        @ForeignKey(name = "fk_transporte_transportadora")
        @JoinColumn(name="seq_transportadora", referencedColumnName="seq_transportadora", insertable=true, updatable=true)
        public Transportadora getTransportadora() {
                return transportadora;
        }
        public void setTransportadora(Transportadora transportadora) {
                this.transportadora = transportadora;
        }
       
        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + ((sequencial == null) ? 0 : sequencial.hashCode());
                return result;
        }
       
        @Override
        public boolean equals(Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
                        return false;
                if (getClass() != obj.getClass())
                        return false;
                Transporte other = (Transporte) obj;
                if (sequencial == null) {
                        if (other.sequencial != null)
                                return false;
                } else if (!sequencial.equals(other.sequencial))
                        return false;
                return true;
        }
       
}