Subversion Repositories Integrator Subversion

Rev

Rev 474 | Rev 487 | 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
        @NotNull(message = "Parâmetro obrigatório não preenchido: Quantidade do volume", groups = {Cadastrar.class, Alterar.class})
72
        @Column(name="qtd_volume")
73
        public Integer getQuantidade() {
74
                return quantidade;
75
        }
76
        public void setQuantidade(Integer quantidade) {
77
                this.quantidade = quantidade;
78
        }
79
 
80
        @NotNull(message = "Parâmetro obrigatório não preenchido: Descrição do volume", groups = {Cadastrar.class, Alterar.class})
81
        @Column(name="dsc_volume")
82
        public String getVolumeEspecie() {
83
                return volumeEspecie;
84
        }
85
        public void setVolumeEspecie(String volumeEspecie) {
86
                this.volumeEspecie = volumeEspecie;
87
        }
88
 
89
        @NotNull(message = "Parâmetro obrigatório não preenchido: Peso bruto", groups = {Cadastrar.class, Alterar.class})
90
        @Column(name="val_peso_bruto")
91
        public Double getPesoBruto() {
92
                return pesoBruto;
93
        }
94
        public void setPesoBruto(Double pesoBruto) {
95
                this.pesoBruto = pesoBruto;
96
        }
97
 
98
        @NotNull(message = "Parâmetro obrigatório não preenchido: Peso líquido", groups = {Cadastrar.class, Alterar.class})
99
        @Column(name="val_peso_liquido")
100
        public Double getPesoLiquido() {
101
                return pesoLiquido;
102
        }
103
        public void setPesoLiquido(Double pesoLiquido) {
104
                this.pesoLiquido = pesoLiquido;
105
        }
106
 
107
        @ManyToOne
108
        @ForeignKey(name = "fk_transporte_transportadora")
109
        @JoinColumn(name="seq_transportadora", referencedColumnName="seq_transportadora", insertable=true, updatable=true)
110
        public Transportadora getTransportadora() {
111
                return transportadora;
112
        }
113
        public void setTransportadora(Transportadora transportadora) {
114
                this.transportadora = transportadora;
115
        }
116
 
117
        @Override
118
        public int hashCode() {
119
                final int prime = 31;
120
                int result = 1;
121
                result = prime * result + ((sequencial == null) ? 0 : sequencial.hashCode());
122
                return result;
123
        }
124
 
125
        @Override
126
        public boolean equals(Object obj) {
127
                if (this == obj)
128
                        return true;
129
                if (obj == null)
130
                        return false;
131
                if (getClass() != obj.getClass())
132
                        return false;
133
                Transporte other = (Transporte) obj;
134
                if (sequencial == null) {
135
                        if (other.sequencial != null)
136
                                return false;
137
                } else if (!sequencial.equals(other.sequencial))
138
                        return false;
139
                return true;
140
        }
141
 
142
}