Rev 477 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 474 | blopes | 1 | package br.com.ec.domain.model; |
| 2 | |||
| 3 | import java.io.Serializable; |
||
| 4 | |||
| 5 | import javax.persistence.Column; |
||
| 6 | import javax.persistence.Entity; |
||
| 7 | import javax.persistence.GeneratedValue; |
||
| 8 | import javax.persistence.GenerationType; |
||
| 9 | import javax.persistence.Id; |
||
| 10 | import javax.persistence.JoinColumn; |
||
| 11 | import javax.persistence.ManyToOne; |
||
| 12 | import javax.persistence.SequenceGenerator; |
||
| 13 | import javax.persistence.Table; |
||
| 14 | import javax.persistence.Transient; |
||
| 15 | import javax.validation.constraints.NotNull; |
||
| 16 | |||
| 17 | import org.hibernate.annotations.ForeignKey; |
||
| 18 | |||
| 19 | import br.com.ec.core.interfaces.Alterar; |
||
| 20 | import br.com.ec.core.interfaces.Cadastrar; |
||
| 21 | import br.com.ec.core.util.VerificadorUtil; |
||
| 22 | |||
| 23 | @Entity |
||
| 24 | @Table(name="sec_transporte", schema="sc_sec") |
||
| 25 | public class Transporte implements Serializable { |
||
| 26 | |||
| 27 | private static final long serialVersionUID = 1L; |
||
| 28 | |||
| 29 | private Long sequencial; |
||
| 477 | blopes | 30 | private Integer codigoModalidadeFrete; |
| 474 | blopes | 31 | private Integer quantidade; |
| 32 | private String volumeEspecie; |
||
| 33 | private Double pesoBruto; |
||
| 34 | private Double pesoLiquido; |
||
| 35 | |||
| 36 | // private String marca; |
||
| 37 | // private String numeracao; |
||
| 38 | |||
| 39 | private Transportadora transportadora; |
||
| 40 | // private String nome; |
||
| 41 | // private String codigoANTT; |
||
| 42 | // private String placaVeiculo; |
||
| 43 | // private String ufVeiculo; |
||
| 44 | // private String cnpjCpfTransportadora; |
||
| 45 | // private String enderecoTransportadora; |
||
| 46 | // private String municipioTransportadora; |
||
| 47 | // private String ufTransportadora; |
||
| 48 | // private String inscricaoEstadualTransportadora; |
||
| 49 | |||
| 50 | |||
| 51 | @Id |
||
| 52 | @SequenceGenerator(name = "sq_transporte") |
||
| 53 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
||
| 54 | @Column(name="seq_transporte", nullable=false) |
||
| 55 | public Long getSequencial() { |
||
| 56 | return sequencial; |
||
| 57 | } |
||
| 58 | public void setSequencial(Long sequencial) { |
||
| 59 | this.sequencial = sequencial; |
||
| 60 | } |
||
| 61 | |||
| 62 | @NotNull(message = "Parâmetro obrigatório não preenchido: Modalidade do frete", groups = {Cadastrar.class, Alterar.class}) |
||
| 63 | @Column(name="cod_modalidade_frete") |
||
| 477 | blopes | 64 | public Integer getCodigoModalidadeFrete() { |
| 474 | blopes | 65 | return codigoModalidadeFrete; |
| 66 | } |
||
| 477 | blopes | 67 | public void setCodigoModalidadeFrete(Integer codigoModalidadeFrete) { |
| 474 | blopes | 68 | this.codigoModalidadeFrete = codigoModalidadeFrete; |
| 69 | } |
||
| 70 | |||
| 71 | @Column(name="qtd_volume") |
||
| 72 | public Integer getQuantidade() { |
||
| 73 | return quantidade; |
||
| 74 | } |
||
| 75 | public void setQuantidade(Integer quantidade) { |
||
| 76 | this.quantidade = quantidade; |
||
| 77 | } |
||
| 78 | |||
| 79 | @Column(name="dsc_volume") |
||
| 80 | public String getVolumeEspecie() { |
||
| 81 | return volumeEspecie; |
||
| 82 | } |
||
| 83 | public void setVolumeEspecie(String volumeEspecie) { |
||
| 84 | this.volumeEspecie = volumeEspecie; |
||
| 85 | } |
||
| 86 | |||
| 87 | @Column(name="val_peso_bruto") |
||
| 88 | public Double getPesoBruto() { |
||
| 89 | return pesoBruto; |
||
| 90 | } |
||
| 91 | public void setPesoBruto(Double pesoBruto) { |
||
| 92 | this.pesoBruto = pesoBruto; |
||
| 93 | } |
||
| 94 | |||
| 95 | @Column(name="val_peso_liquido") |
||
| 96 | public Double getPesoLiquido() { |
||
| 97 | return pesoLiquido; |
||
| 98 | } |
||
| 99 | public void setPesoLiquido(Double pesoLiquido) { |
||
| 100 | this.pesoLiquido = pesoLiquido; |
||
| 101 | } |
||
| 102 | |||
| 103 | @ManyToOne |
||
| 104 | @ForeignKey(name = "fk_transporte_transportadora") |
||
| 105 | @JoinColumn(name="seq_transportadora", referencedColumnName="seq_transportadora", insertable=true, updatable=true) |
||
| 106 | public Transportadora getTransportadora() { |
||
| 107 | return transportadora; |
||
| 108 | } |
||
| 109 | public void setTransportadora(Transportadora transportadora) { |
||
| 110 | this.transportadora = transportadora; |
||
| 111 | } |
||
| 112 | |||
| 113 | @Override |
||
| 114 | public int hashCode() { |
||
| 115 | final int prime = 31; |
||
| 116 | int result = 1; |
||
| 117 | result = prime * result + ((sequencial == null) ? 0 : sequencial.hashCode()); |
||
| 118 | return result; |
||
| 119 | } |
||
| 120 | |||
| 121 | @Override |
||
| 122 | public boolean equals(Object obj) { |
||
| 123 | if (this == obj) |
||
| 124 | return true; |
||
| 125 | if (obj == null) |
||
| 126 | return false; |
||
| 127 | if (getClass() != obj.getClass()) |
||
| 128 | return false; |
||
| 129 | Transporte other = (Transporte) obj; |
||
| 130 | if (sequencial == null) { |
||
| 131 | if (other.sequencial != null) |
||
| 132 | return false; |
||
| 133 | } else if (!sequencial.equals(other.sequencial)) |
||
| 134 | return false; |
||
| 135 | return true; |
||
| 136 | } |
||
| 137 | |||
| 138 | } |