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 br.gov.al.saude.framework.core.generic.identidade.Identidade; |
||
| 12 | |||
| 13 | @Entity |
||
| 14 | @Table(name="srv_conselho", schema="sc_srv") |
||
| 15 | public class Conselho implements Serializable, Identidade { |
||
| 16 | private static final long serialVersionUID = 1L; |
||
| 17 | |||
| 18 | private Integer codigo; |
||
| 19 | private String descricao; |
||
| 20 | private String sigla; |
||
| 21 | |||
| 22 | |||
| 23 | @Id |
||
| 24 | @Column(name="cod_conselho", length=2, nullable=false) |
||
| 25 | public Integer getCodigo() { |
||
| 26 | return codigo; |
||
| 27 | } |
||
| 28 | public void setCodigo(Integer codigo) { |
||
| 29 | this.codigo = codigo; |
||
| 30 | } |
||
| 31 | |||
| 32 | |||
| 33 | @Column(name="dsc_conselho", length=50, nullable=false) |
||
| 34 | public String getDescricao() { |
||
| 35 | return descricao; |
||
| 36 | } |
||
| 37 | public void setDescricao(String descricao) { |
||
| 38 | this.descricao = descricao; |
||
| 39 | } |
||
| 40 | |||
| 41 | |||
| 42 | @Column(name="dsc_sigla_conselho", length=10, nullable=false) |
||
| 43 | public String getSigla() { |
||
| 44 | return sigla; |
||
| 45 | } |
||
| 46 | public void setSigla(String sigla) { |
||
| 47 | this.sigla = sigla; |
||
| 48 | } |
||
| 49 | |||
| 50 | |||
| 51 | @Transient |
||
| 52 | @Override |
||
| 53 | public Object getId() { |
||
| 54 | return getCodigo(); |
||
| 55 | } |
||
| 56 | @Override |
||
| 57 | public void setId(Object codigo) { |
||
| 58 | setCodigo((Integer) codigo); |
||
| 59 | } |
||
| 60 | |||
| 61 | |||
| 62 | @Override |
||
| 63 | public int hashCode() { |
||
| 64 | final int prime = 31; |
||
| 65 | int result = 1; |
||
| 66 | result = prime * result + ((codigo == null) ? 0 : codigo.hashCode()); |
||
| 67 | return result; |
||
| 68 | } |
||
| 69 | |||
| 70 | @Override |
||
| 71 | public boolean equals(Object obj) { |
||
| 72 | if (this == obj) |
||
| 73 | return true; |
||
| 74 | if (obj == null) |
||
| 75 | return false; |
||
| 76 | if (getClass() != obj.getClass()) |
||
| 77 | return false; |
||
| 78 | Conselho other = (Conselho) obj; |
||
| 79 | if (codigo == null) { |
||
| 80 | if (other.codigo != null) |
||
| 81 | return false; |
||
| 82 | } else if (!codigo.equals(other.codigo)) |
||
| 83 | return false; |
||
| 84 | return true; |
||
| 85 | } |
||
| 86 | } |