Rev 259 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 259 | Rev 294 | ||
|---|---|---|---|
| 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.domain.model.tipos.TipoContaBancaria; |
|
| 21 | 25 | ||
| 22 | @Entity |
26 | @Entity |
| 23 | @Table(name="sec_conta_bancaria", schema="sc_sec") |
27 | @Table(name="sec_conta_bancaria", schema="sc_sec") |
| 24 | public class ContaBancaria implements Serializable { |
28 | public class ContaBancaria implements Serializable { |
| 25 | 29 | ||
| 26 | private static final long serialVersionUID = 1L; |
30 | private static final long serialVersionUID = 1L; |
| 27 | private static final long CONTA_CAIXA = 1L; |
31 | private static final long CONTA_CAIXA = 1L; |
| 28 | 32 | ||
| 29 | private Long sequencial; |
33 | private Long sequencial; |
| 30 | private String descricao; |
34 | private String descricao; |
| - | 35 | private Pessoa pessoa; |
|
| - | 36 | private String tipoContaBancaria; // C - CAIXA (RECEBIMENTO EM: DINHEIRO E CUPONS) e B - BANCO |
|
| 31 | private Boolean ativo; |
37 | private Boolean ativo; |
| 32 | 38 | ||
| 33 | public ContaBancaria() {} |
39 | public ContaBancaria() {} |
| 34 | 40 | ||
| 35 | public ContaBancaria(Long sequencial) { |
41 | public ContaBancaria(Long sequencial) { |
| Line 54... | Line 60... | ||
| 54 | public String getDescricao() { |
60 | public String getDescricao() { |
| 55 | return descricao; |
61 | return descricao; |
| 56 | }
|
62 | }
|
| 57 | public void setDescricao(String descricao) { |
63 | public void setDescricao(String descricao) { |
| 58 | this.descricao = StringUtil.setarUpperCaseComTrim(descricao); |
64 | this.descricao = StringUtil.setarUpperCaseComTrim(descricao); |
| - | 65 | }
|
|
| - | 66 | ||
| - | 67 | @ManyToOne |
|
| - | 68 | @ForeignKey(name="fk_contabancaria_pessoa") |
|
| - | 69 | @JoinColumn(name = "seq_pessoa", nullable=true) |
|
| - | 70 | public Pessoa getPessoa() { |
|
| - | 71 | return pessoa; |
|
| - | 72 | }
|
|
| - | 73 | public void setPessoa(Pessoa pessoa) { |
|
| - | 74 | this.pessoa = pessoa; |
|
| - | 75 | }
|
|
| - | 76 | ||
| - | 77 | @Column(name="tip_conta_bancaria", nullable=false) |
|
| - | 78 | @NotNull(message="Obrigatório informar o tipo da conta bancária", groups={Cadastrar.class, Alterar.class}) |
|
| - | 79 | public String getTipoContaBancaria() { |
|
| - | 80 | return tipoContaBancaria; |
|
| - | 81 | }
|
|
| - | 82 | public void setTipoContaBancaria(String tipoContaBancaria) { |
|
| - | 83 | this.tipoContaBancaria = tipoContaBancaria; |
|
| - | 84 | }
|
|
| - | 85 | ||
| - | 86 | @Transient |
|
| - | 87 | public String getTipoContaBancariaDescricao() { |
|
| - | 88 | return TipoContaBancaria.parse(getTipoContaBancaria()).getDescricao(); |
|
| 59 | }
|
89 | }
|
| 60 | 90 | ||
| 61 | @Column(name="ind_ativo", nullable=false) |
91 | @Column(name="ind_ativo", nullable=false) |
| 62 | public Boolean getAtivo() { |
92 | public Boolean getAtivo() { |
| 63 | return ativo; |
93 | return ativo; |