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