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 | import br.gov.al.saude.framework.core.util.VerificadorUtil; |
||
| 13 | import br.gov.al.saude.srv.model.enums.TipoVinculo; |
||
| 14 | |||
| 15 | @Entity |
||
| 16 | @Table(name="srv_forma_ingresso", schema="sc_srv") |
||
| 17 | public class FormaIngresso implements Serializable, Identidade { |
||
| 18 | private static final long serialVersionUID = 1L; |
||
| 19 | |||
| 20 | public static Integer FORMA_INGRESSO_CONCURSADO = 1; |
||
| 21 | public static Integer FORMA_INGRESSO_COMISSIONADO = 3; |
||
| 22 | public static Integer FORMA_INGRESSO_PROCESSO_SELETIVO = 8; |
||
| 23 | public static Integer FORMA_INGRESSO_PRESTADOR = 9; |
||
| 24 | public static Integer FORMA_INGRESSO_ESTAGIARIO = 4; |
||
| 25 | |||
| 26 | private Integer codigo; |
||
| 27 | private String descricao; |
||
| 28 | private String tipoVinculo; |
||
| 29 | |||
| 30 | @Id |
||
| 31 | @Column(name="cod_forma_ingresso", length=3, nullable=false) |
||
| 32 | public Integer getCodigo() { |
||
| 33 | return codigo; |
||
| 34 | } |
||
| 35 | public void setCodigo(Integer codigo) { |
||
| 36 | this.codigo = codigo; |
||
| 37 | } |
||
| 38 | |||
| 39 | |||
| 40 | @Column(name="dsc_forma_ingresso", length=50, nullable=false) |
||
| 41 | public String getDescricao() { |
||
| 42 | return descricao; |
||
| 43 | } |
||
| 44 | public void setDescricao(String descricao) { |
||
| 45 | this.descricao = descricao; |
||
| 46 | } |
||
| 47 | |||
| 48 | |||
| 49 | @Column(name="tip_vinculo_forma_ingresso", length=1, nullable=false) |
||
| 50 | public String getTipoVinculo() { |
||
| 51 | return tipoVinculo; |
||
| 52 | } |
||
| 53 | public void setTipoVinculo(String tipoVinculo) { |
||
| 54 | this.tipoVinculo = tipoVinculo; |
||
| 55 | } |
||
| 56 | @Transient |
||
| 57 | public String getDescricaoTipoVinculo() { |
||
| 58 | return VerificadorUtil.naoEstaNuloOuVazio(tipoVinculo) ? TipoVinculo.parse(tipoVinculo).getDescricao() : ""; |
||
| 59 | } |
||
| 60 | |||
| 61 | @Transient |
||
| 62 | @Override |
||
| 63 | public Object getId() { |
||
| 64 | return getCodigo(); |
||
| 65 | } |
||
| 66 | @Override |
||
| 67 | public void setId(Object id) { |
||
| 68 | setCodigo((Integer) id); |
||
| 69 | } |
||
| 70 | |||
| 71 | |||
| 72 | @Override |
||
| 73 | public int hashCode() { |
||
| 74 | final int prime = 31; |
||
| 75 | int result = 1; |
||
| 76 | result = prime * result + ((codigo == null) ? 0 : codigo.hashCode()); |
||
| 77 | return result; |
||
| 78 | } |
||
| 79 | |||
| 80 | @Override |
||
| 81 | public boolean equals(Object obj) { |
||
| 82 | if (this == obj) |
||
| 83 | return true; |
||
| 84 | if (obj == null) |
||
| 85 | return false; |
||
| 86 | if (getClass() != obj.getClass()) |
||
| 87 | return false; |
||
| 88 | FormaIngresso other = (FormaIngresso) obj; |
||
| 89 | if (codigo == null) { |
||
| 90 | if (other.codigo != null) |
||
| 91 | return false; |
||
| 92 | } else if (!codigo.equals(other.codigo)) |
||
| 93 | return false; |
||
| 94 | return true; |
||
| 95 | } |
||
| 96 | |||
| 97 | } |