Rev 291 | Rev 344 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 291 | Rev 293 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | package br.com.ec.domain.model; |
1 | package br.com.ec.domain.model; |
| 2 | 2 | ||
| 3 | import java.beans.Transient; |
- | |
| 4 | import java.io.Serializable; |
3 | import java.io.Serializable; |
| 5 | 4 | ||
| 6 | import javax.persistence.Column; |
5 | import javax.persistence.Column; |
| 7 | import javax.persistence.Entity; |
6 | import javax.persistence.Entity; |
| 8 | import javax.persistence.GeneratedValue; |
7 | import javax.persistence.GeneratedValue; |
| 9 | import javax.persistence.GenerationType; |
8 | import javax.persistence.GenerationType; |
| 10 | import javax.persistence.Id; |
9 | import javax.persistence.Id; |
| - | 10 | import javax.persistence.JoinColumn; |
|
| - | 11 | import javax.persistence.ManyToOne; |
|
| 11 | import javax.persistence.SequenceGenerator; |
12 | import javax.persistence.SequenceGenerator; |
| 12 | import javax.persistence.Table; |
13 | import javax.persistence.Table; |
| - | 14 | import javax.persistence.Transient; |
|
| 13 | import javax.validation.constraints.NotNull; |
15 | import javax.validation.constraints.NotNull; |
| 14 | import javax.validation.constraints.Size; |
16 | import javax.validation.constraints.Size; |
| 15 | 17 | ||
| - | 18 | import org.hibernate.annotations.ForeignKey; |
|
| 16 | import org.hibernate.validator.constraints.NotEmpty; |
19 | import org.hibernate.validator.constraints.NotEmpty; |
| 17 | 20 | ||
| 18 | import br.com.ec.core.interfaces.Alterar; |
21 | import br.com.ec.core.interfaces.Alterar; |
| 19 | import br.com.ec.core.interfaces.Cadastrar; |
22 | import br.com.ec.core.interfaces.Cadastrar; |
| 20 | import br.com.ec.core.util.StringUtil; |
23 | import br.com.ec.core.util.StringUtil; |
| - | 24 | import br.com.ec.core.util.VerificadorUtil; |
|
| - | 25 | import br.com.ec.domain.model.tipos.TipoContaBancaria; |
|
| 21 | 26 | ||
| 22 | @Entity |
27 | @Entity |
| 23 | @Table(name="sec_conta_bancaria", schema="sc_sec") |
28 | @Table(name="sec_conta_bancaria", schema="sc_sec") |
| 24 | public class ContaBancaria implements Serializable { |
29 | public class ContaBancaria implements Serializable { |
| 25 | 30 | ||
| Line 28... | Line 33... | ||
| 28 | private static final long CONTA_PIX = 5L; |
33 | private static final long CONTA_PIX = 5L; |
| 29 | private static final long CONTA_CASA_DAS_CAPAS = 4L; |
34 | private static final long CONTA_CASA_DAS_CAPAS = 4L; |
| 30 | 35 | ||
| 31 | private Long sequencial; |
36 | private Long sequencial; |
| 32 | private String descricao; |
37 | private String descricao; |
| 33 | // private String tipoContaBancaria; CAIXA (RECEBIMENTO EM: DINHEIRO E CUPONS) E PIX
|
- | |
| - | 38 | private Pessoa pessoa; |
|
| - | 39 | private String tipoContaBancaria; // C - CAIXA (RECEBIMENTO EM: DINHEIRO E CUPONS) e B - BANCO |
|
| 34 | private Boolean ativo; |
40 | private Boolean ativo; |
| 35 | 41 | ||
| 36 | public ContaBancaria() {} |
42 | public ContaBancaria() {} |
| 37 | 43 | ||
| 38 | public ContaBancaria(Long sequencial) { |
44 | public ContaBancaria(Long sequencial) { |
| Line 57... | Line 63... | ||
| 57 | public String getDescricao() { |
63 | public String getDescricao() { |
| 58 | return descricao; |
64 | return descricao; |
| 59 | }
|
65 | }
|
| 60 | public void setDescricao(String descricao) { |
66 | public void setDescricao(String descricao) { |
| 61 | this.descricao = StringUtil.setarUpperCaseComTrim(descricao); |
67 | this.descricao = StringUtil.setarUpperCaseComTrim(descricao); |
| - | 68 | }
|
|
| - | 69 | ||
| - | 70 | @ManyToOne |
|
| - | 71 | @ForeignKey(name="fk_contabancaria_pessoa") |
|
| - | 72 | @JoinColumn(name = "seq_pessoa", nullable=true) |
|
| - | 73 | public Pessoa getPessoa() { |
|
| - | 74 | return pessoa; |
|
| - | 75 | }
|
|
| - | 76 | public void setPessoa(Pessoa pessoa) { |
|
| - | 77 | this.pessoa = pessoa; |
|
| - | 78 | }
|
|
| - | 79 | ||
| - | 80 | @Column(name="tip_conta_bancaria", nullable=false) |
|
| - | 81 | @NotNull(message="Obrigatório informar o tipo da conta bancária", groups={Cadastrar.class, Alterar.class}) |
|
| - | 82 | public String getTipoContaBancaria() { |
|
| - | 83 | return tipoContaBancaria; |
|
| - | 84 | }
|
|
| - | 85 | public void setTipoContaBancaria(String tipoContaBancaria) { |
|
| - | 86 | this.tipoContaBancaria = tipoContaBancaria; |
|
| - | 87 | }
|
|
| - | 88 | ||
| - | 89 | @Transient |
|
| - | 90 | public String getTipoContaBancariaDescricao() { |
|
| - | 91 | return TipoContaBancaria.parse(getTipoContaBancaria()).getDescricao(); |
|
| 62 | }
|
92 | }
|
| 63 | 93 | ||
| 64 | @Column(name="ind_ativo", nullable=false) |
94 | @Column(name="ind_ativo", nullable=false) |
| 65 | public Boolean getAtivo() { |
95 | public Boolean getAtivo() { |
| 66 | return ativo; |
96 | return ativo; |
| Line 81... | Line 111... | ||
| 81 | }
|
111 | }
|
| 82 | 112 | ||
| 83 | @Transient |
113 | @Transient |
| 84 | public static long getContaCasaDasCapas() { |
114 | public static long getContaCasaDasCapas() { |
| 85 | return CONTA_CASA_DAS_CAPAS; |
115 | return CONTA_CASA_DAS_CAPAS; |
| - | 116 | }
|
|
| - | 117 | ||
| - | 118 | @Transient |
|
| - | 119 | public String getNomePessoa() { |
|
| - | 120 | return VerificadorUtil.naoEstaNulo(getPessoa())? getPessoa().getNome() : ""; |
|
| - | 121 | }
|
|
| - | 122 | ||
| - | 123 | @Transient |
|
| - | 124 | public String getCpfCnpjPessoa() { |
|
| - | 125 | return VerificadorUtil.naoEstaNulo(getPessoa())? getPessoa().getCpfCnpjFormatado() : ""; |
|
| 86 | }
|
126 | }
|
| 87 | 127 | ||
| 88 | @Override |
128 | @Override |
| 89 | public int hashCode() { |
129 | public int hashCode() { |
| 90 | final int prime = 31; |
130 | final int prime = 31; |