Rev 771 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 771 | Rev 778 | ||
|---|---|---|---|
| Line 7... | Line 7... | ||
| 7 | import javax.persistence.GeneratedValue; |
7 | import javax.persistence.GeneratedValue; |
| 8 | import javax.persistence.GenerationType; |
8 | import javax.persistence.GenerationType; |
| 9 | import javax.persistence.Id; |
9 | import javax.persistence.Id; |
| 10 | import javax.persistence.SequenceGenerator; |
10 | import javax.persistence.SequenceGenerator; |
| 11 | import javax.persistence.Table; |
11 | import javax.persistence.Table; |
| - | 12 | import javax.persistence.Transient; |
|
| - | 13 | import javax.validation.constraints.NotNull; |
|
| 12 | import javax.validation.constraints.Size; |
14 | import javax.validation.constraints.Size; |
| 13 | 15 | ||
| 14 | import org.hibernate.validator.constraints.NotEmpty; |
16 | import org.hibernate.validator.constraints.NotEmpty; |
| 15 | 17 | ||
| 16 | import br.com.ec.core.interfaces.Alterar; |
18 | import br.com.ec.core.interfaces.Alterar; |
| 17 | import br.com.ec.core.interfaces.Cadastrar; |
19 | import br.com.ec.core.interfaces.Cadastrar; |
| 18 | import br.com.ec.core.util.StringUtil; |
20 | import br.com.ec.core.util.StringUtil; |
| - | 21 | import br.com.ec.core.util.VerificadorUtil; |
|
| - | 22 | import br.com.sl.domain.model.tipos.TipoTendencia; |
|
| 19 | 23 | ||
| 20 | @Entity |
24 | @Entity |
| 21 | @Table(name="slp_ativo", schema="sc_slp") |
25 | @Table(name="slp_ativo", schema="sc_slp") |
| 22 | public class Ativo implements Serializable { |
26 | public class Ativo implements Serializable { |
| 23 | 27 | ||
| 24 | private static final long serialVersionUID = 1L; |
28 | private static final long serialVersionUID = 1L; |
| 25 | 29 | ||
| 26 | private Long sequencial; |
30 | private Long sequencial; |
| 27 | private String nome; |
31 | private String nome; |
| - | 32 | private String tipoTendencia; |
|
| - | 33 | private Boolean ativo; |
|
| 28 | 34 | ||
| 29 | public Ativo() {} |
35 | public Ativo() {} |
| 30 | 36 | ||
| 31 | public Ativo(Long sequencial, String nome) { |
37 | public Ativo(Long sequencial, String nome) { |
| 32 | this.sequencial = sequencial; |
38 | this.sequencial = sequencial; |
| Line 50... | Line 56... | ||
| 50 | public String getNome() { |
56 | public String getNome() { |
| 51 | return nome; |
57 | return nome; |
| 52 | }
|
58 | }
|
| 53 | public void setNome(String nome) { |
59 | public void setNome(String nome) { |
| 54 | this.nome = StringUtil.setarUpperCaseComTrim(nome); |
60 | this.nome = StringUtil.setarUpperCaseComTrim(nome); |
| - | 61 | }
|
|
| - | 62 | ||
| - | 63 | @Column(name="tip_tendencia") |
|
| - | 64 | @NotNull(message = "Parâmetro obrigatório não preenchido: Tipo de tendência", groups = {Cadastrar.class, Alterar.class}) |
|
| - | 65 | public String getTipoTendencia() { |
|
| - | 66 | return tipoTendencia; |
|
| - | 67 | }
|
|
| - | 68 | public void setTipoTendencia(String tipoTendencia) { |
|
| - | 69 | this.tipoTendencia = tipoTendencia; |
|
| - | 70 | }
|
|
| - | 71 | ||
| - | 72 | @Transient |
|
| - | 73 | public String getDescricaoDaTendencia() { |
|
| - | 74 | return VerificadorUtil.naoEstaNulo(getTipoTendencia())? TipoTendencia.parse(getTipoTendencia()).getDescricao() : ""; |
|
| - | 75 | }
|
|
| - | 76 | ||
| - | 77 | @Column(name="ind_ativo", nullable=false) |
|
| - | 78 | public Boolean getAtivo() { |
|
| - | 79 | return ativo; |
|
| - | 80 | }
|
|
| - | 81 | public void setAtivo(Boolean ativo) { |
|
| - | 82 | this.ativo = ativo; |
|
| 55 | }
|
83 | }
|
| 56 | 84 | ||
| 57 | @Override |
85 | @Override |
| 58 | public int hashCode() { |
86 | public int hashCode() { |
| 59 | final int prime = 31; |
87 | final int prime = 31; |