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