Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 espaco 1
package br.gov.al.saude.srv.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.persistence.Transient;
10
 
11
import org.hibernate.validator.constraints.NotEmpty;
12
 
13
import br.gov.al.saude.framework.core.generic.identidade.Identidade;
14
import br.gov.al.saude.framework.core.interfaces.Alterar;
15
import br.gov.al.saude.framework.core.interfaces.Cadastrar;
16
 
17
@Entity
18
@Table(name="srv_parametro", schema="sc_srv")
19
public class Parametro implements Serializable, Identidade {
20
 
21
        private static final long serialVersionUID = 1L;
22
 
23
        private Integer codigo;
24
        private String descricao;
25
        private String valor;
26
 
27
        @Id
28
        @Column(name="cod_parametro", nullable=false)
29
        public Integer getCodigo() {
30
                return codigo;
31
        }
32
 
33
        public void setCodigo(Integer codigo) {
34
                this.codigo = codigo;
35
        }
36
 
37
        @Column(name="dsc_parametro", nullable=false)
38
        public String getDescricao() {
39
                return descricao;
40
        }
41
 
42
        public void setDescricao(String descricao) {
43
                this.descricao = descricao;
44
        }
45
 
46
        @Column(name="dsc_valor_parametro", nullable=false)
47
        @NotEmpty(message="Obrigatório informar o valor.", groups={Cadastrar.class, Alterar.class})
48
        public String getValor() {
49
                return valor;
50
        }
51
 
52
        public void setValor(String valor) {
53
                this.valor = valor;
54
        }
55
 
56
        @Override
57
        @Transient
58
        public Object getId() {
59
                return this.codigo;
60
        }
61
 
62
        @Override
63
        public void setId(Object id) {
64
                this.codigo = (Integer) id;
65
        }
66
 
67
        @Override
68
        public int hashCode() {
69
                final int prime = 31;
70
                int result = 1;
71
                result = prime * result + ((codigo == null) ? 0 : codigo.hashCode());
72
                return result;
73
        }
74
 
75
        @Override
76
        public boolean equals(Object obj) {
77
                if (this == obj)
78
                        return true;
79
                if (obj == null)
80
                        return false;
81
                if (!(obj instanceof Parametro))
82
                        return false;
83
                Parametro other = (Parametro) obj;
84
                if (codigo == null) {
85
                        if (other.codigo != null)
86
                                return false;
87
                } else if (!codigo.equals(other.codigo))
88
                        return false;
89
                return true;
90
        }
91
 
92
}