Rev 106 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 106 | espaco | 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.Id; |
||
| 8 | import javax.persistence.Table; |
||
| 9 | import javax.validation.constraints.NotNull; |
||
| 10 | import javax.validation.constraints.Size; |
||
| 11 | |||
| 12 | import org.hibernate.validator.constraints.NotEmpty; |
||
| 13 | |||
| 195 | espaco | 14 | import br.com.ec.core.interfaces.Alterar; |
| 15 | import br.com.ec.core.interfaces.Cadastrar; |
||
| 16 | import br.com.ec.core.util.StringUtil; |
||
| 106 | espaco | 17 | |
| 18 | @Entity |
||
| 19 | @Table(name="sec_parametro", schema="sc_sec") |
||
| 20 | public class Parametro implements Serializable { |
||
| 21 | |||
| 22 | private static final long serialVersionUID = 1L; |
||
| 23 | |||
| 24 | private Long codigo; |
||
| 25 | private String descricao; |
||
| 26 | private String valor; |
||
| 27 | private Boolean ativo; |
||
| 28 | |||
| 29 | public Parametro() {} |
||
| 30 | |||
| 31 | @Id |
||
| 32 | @Column(name="cod_parametro", nullable=false) |
||
| 33 | public Long getCodigo() { |
||
| 34 | return codigo; |
||
| 35 | } |
||
| 36 | public void setCodigo(Long codigo) { |
||
| 37 | this.codigo = codigo; |
||
| 38 | } |
||
| 39 | |||
| 40 | @Column(name="dsc_parametro") |
||
| 41 | @Size(max = 200, message = "Limite de caracteres ultrapassado: Descrição") |
||
| 42 | @NotNull(message="Obrigatório informar a descrição", groups={Cadastrar.class, Alterar.class}) |
||
| 43 | @NotEmpty(message="Obrigatório informar a descrição", groups={Cadastrar.class, Alterar.class}) |
||
| 44 | public String getDescricao() { |
||
| 45 | return descricao; |
||
| 46 | } |
||
| 47 | public void setDescricao(String descricao) { |
||
| 48 | this.descricao = StringUtil.setarUpperCaseComTrim(descricao); |
||
| 49 | } |
||
| 50 | |||
| 51 | @Column(name="dsc_valor") |
||
| 52 | @Size(max = 20, message = "Limite de caracteres ultrapassado: Valor") |
||
| 53 | public String getValor() { |
||
| 54 | return valor; |
||
| 55 | } |
||
| 56 | public void setValor(String valor) { |
||
| 57 | this.valor = valor; |
||
| 58 | } |
||
| 59 | |||
| 60 | @Column(name="ind_ativo", nullable=false) |
||
| 61 | public Boolean getAtivo() { |
||
| 62 | return ativo; |
||
| 63 | } |
||
| 64 | public void setAtivo(Boolean ativo) { |
||
| 65 | this.ativo = ativo; |
||
| 66 | } |
||
| 67 | |||
| 68 | @Override |
||
| 69 | public int hashCode() { |
||
| 70 | final int prime = 31; |
||
| 71 | int result = 1; |
||
| 72 | result = prime * result + ((codigo == null) ? 0 : codigo.hashCode()); |
||
| 73 | return result; |
||
| 74 | } |
||
| 75 | |||
| 76 | @Override |
||
| 77 | public boolean equals(Object obj) { |
||
| 78 | if (this == obj) |
||
| 79 | return true; |
||
| 80 | if (obj == null) |
||
| 81 | return false; |
||
| 82 | if (getClass() != obj.getClass()) |
||
| 83 | return false; |
||
| 84 | Parametro other = (Parametro) obj; |
||
| 85 | if (codigo == null) { |
||
| 86 | if (other.codigo != null) |
||
| 87 | return false; |
||
| 88 | } else if (!codigo.equals(other.codigo)) |
||
| 89 | return false; |
||
| 90 | return true; |
||
| 91 | } |
||
| 92 | |||
| 93 | } |