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 | import java.util.Date; |
||
| 5 | |||
| 6 | import javax.persistence.Column; |
||
| 7 | import javax.persistence.Entity; |
||
| 8 | import javax.persistence.Inheritance; |
||
| 9 | import javax.persistence.InheritanceType; |
||
| 10 | import javax.persistence.JoinColumn; |
||
| 11 | import javax.persistence.ManyToOne; |
||
| 12 | import javax.persistence.PrimaryKeyJoinColumn; |
||
| 13 | import javax.persistence.Table; |
||
| 14 | import javax.persistence.Temporal; |
||
| 15 | import javax.persistence.TemporalType; |
||
| 16 | import javax.persistence.Transient; |
||
| 17 | import javax.validation.constraints.NotNull; |
||
| 18 | |||
| 19 | import org.hibernate.envers.AuditTable; |
||
| 20 | import org.hibernate.envers.Audited; |
||
| 21 | import org.hibernate.envers.RelationTargetAuditMode; |
||
| 22 | |||
| 23 | import br.gov.al.saude.framework.core.interfaces.Alterar; |
||
| 24 | import br.gov.al.saude.framework.core.interfaces.Cadastrar; |
||
| 25 | import br.gov.al.saude.framework.core.util.VerificadorUtil; |
||
| 26 | import br.gov.al.saude.srv.model.enums.TipoRegimeTrabalho; |
||
| 27 | |||
| 28 | @Audited |
||
| 29 | @AuditTable(value="srv_hist_servdadofunc_matricula", schema="sc_srv") |
||
| 30 | @Entity |
||
| 31 | @Table(name = "srv_servdadofunc_matricula", schema = "sc_srv") |
||
| 32 | @Inheritance(strategy=InheritanceType.JOINED) |
||
| 33 | @PrimaryKeyJoinColumn(name = "seq_servidor_dadofuncional", referencedColumnName = "seq_servidor_dadofuncional") |
||
| 34 | public class ServidorDadoFuncionalMatricula extends ServidorDadoFuncional implements Serializable { |
||
| 35 | |||
| 36 | private static final long serialVersionUID = 1L; |
||
| 37 | private Long matriculaServidor; |
||
| 38 | private Integer digitoMatricula; |
||
| 39 | private SituacaoServidor situacaoServidor; |
||
| 40 | private Long ordem; |
||
| 41 | private String tipoRegimeTrabalho; |
||
| 42 | private Orgao orgao; |
||
| 43 | private Date dataNomeacao; |
||
| 44 | private Date dataPosse; |
||
| 45 | private Date dataExercicio; |
||
| 46 | private Funcao funcao; |
||
| 47 | |||
| 48 | @Column(name="num_matricula_servidor", nullable=false) |
||
| 49 | @NotNull(message="Obrigatório informar a matrícula.", groups={Cadastrar.class, Alterar.class}) |
||
| 50 | public Long getMatriculaServidor() { |
||
| 51 | return matriculaServidor; |
||
| 52 | } |
||
| 53 | public void setMatriculaServidor(Long matriculaServidor) { |
||
| 54 | this.matriculaServidor = matriculaServidor; |
||
| 55 | } |
||
| 56 | |||
| 57 | @Column(name="num_digito_matricula", nullable=false, length=1) |
||
| 58 | @NotNull(message="Obrigatório informar o dígito da matrícula.", groups={Cadastrar.class, Alterar.class}) |
||
| 59 | public Integer getDigitoMatricula() { |
||
| 60 | return digitoMatricula; |
||
| 61 | } |
||
| 62 | public void setDigitoMatricula(Integer digitoMatricula) { |
||
| 63 | this.digitoMatricula = digitoMatricula; |
||
| 64 | } |
||
| 65 | |||
| 66 | @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) |
||
| 67 | @ManyToOne |
||
| 68 | @JoinColumn(name="cod_situacao_servidor", referencedColumnName="cod_situacao_servidor", nullable=false) |
||
| 69 | @NotNull(message="Obrigatório informar a situação do servidor.", groups={Cadastrar.class, Alterar.class}) |
||
| 70 | public SituacaoServidor getSituacaoServidor() { |
||
| 71 | return situacaoServidor; |
||
| 72 | } |
||
| 73 | public void setSituacaoServidor(SituacaoServidor situacaoServidor) { |
||
| 74 | this.situacaoServidor = situacaoServidor; |
||
| 75 | } |
||
| 76 | |||
| 77 | @Column(name="num_ordem", nullable=false) |
||
| 78 | @NotNull(message="Obrigatório informar o número de ordem.", groups={Cadastrar.class, Alterar.class}) |
||
| 79 | public Long getOrdem() { |
||
| 80 | return ordem; |
||
| 81 | } |
||
| 82 | public void setOrdem(Long ordem) { |
||
| 83 | this.ordem = ordem; |
||
| 84 | } |
||
| 85 | |||
| 86 | @Column(name="tip_regime_trabalho", nullable=false, length=1) |
||
| 87 | @NotNull(message="Obrigatório informar o regime de trabalho.", groups={Cadastrar.class, Alterar.class}) |
||
| 88 | public String getTipoRegimeTrabalho() { |
||
| 89 | return tipoRegimeTrabalho; |
||
| 90 | } |
||
| 91 | public void setTipoRegimeTrabalho(String tipoRegimeTrabalho) { |
||
| 92 | this.tipoRegimeTrabalho = tipoRegimeTrabalho; |
||
| 93 | } |
||
| 94 | @Transient |
||
| 95 | public String getDescricaoTipoRegimeTrabalho() { |
||
| 96 | return VerificadorUtil.naoEstaNuloOuVazio(tipoRegimeTrabalho) ? TipoRegimeTrabalho.parse(tipoRegimeTrabalho).getDescricao() : ""; |
||
| 97 | } |
||
| 98 | |||
| 99 | @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) |
||
| 100 | @ManyToOne |
||
| 101 | @JoinColumn(name="seq_orgao_origem", referencedColumnName="seq_orgao", nullable=false) |
||
| 102 | @NotNull(message="Obrigatório informar o órgão de origem.", groups={Cadastrar.class, Alterar.class}) |
||
| 103 | public Orgao getOrgao() { |
||
| 104 | return orgao; |
||
| 105 | } |
||
| 106 | public void setOrgao(Orgao orgao) { |
||
| 107 | this.orgao = orgao; |
||
| 108 | } |
||
| 109 | |||
| 110 | @Temporal(TemporalType.DATE) |
||
| 111 | @Column(name="dat_nomeacao", nullable=false) |
||
| 112 | @NotNull(message="Obrigatório informar a data de nomeação.", groups={Cadastrar.class, Alterar.class}) |
||
| 113 | public Date getDataNomeacao() { |
||
| 114 | return dataNomeacao; |
||
| 115 | } |
||
| 116 | public void setDataNomeacao(Date dataNomeacao) { |
||
| 117 | this.dataNomeacao = dataNomeacao; |
||
| 118 | } |
||
| 119 | |||
| 120 | @Temporal(TemporalType.DATE) |
||
| 121 | @Column(name="dat_posse", nullable=false) |
||
| 122 | @NotNull(message="Obrigatório informar a data de posse.", groups={Cadastrar.class, Alterar.class}) |
||
| 123 | public Date getDataPosse() { |
||
| 124 | return dataPosse; |
||
| 125 | } |
||
| 126 | public void setDataPosse(Date dataPosse) { |
||
| 127 | this.dataPosse = dataPosse; |
||
| 128 | } |
||
| 129 | |||
| 130 | @Temporal(TemporalType.DATE) |
||
| 131 | @Column(name="dat_exercicio", nullable=false) |
||
| 132 | @NotNull(message="Obrigatório informar a data de exercício.", groups={Cadastrar.class, Alterar.class}) |
||
| 133 | public Date getDataExercicio() { |
||
| 134 | return dataExercicio; |
||
| 135 | } |
||
| 136 | public void setDataExercicio(Date dataExercicio) { |
||
| 137 | this.dataExercicio = dataExercicio; |
||
| 138 | } |
||
| 139 | |||
| 140 | @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) |
||
| 141 | @ManyToOne |
||
| 142 | @JoinColumn(name="cod_funcao", referencedColumnName="cod_funcao", nullable=false) |
||
| 143 | public Funcao getFuncao() { |
||
| 144 | return funcao; |
||
| 145 | } |
||
| 146 | public void setFuncao(Funcao funcao) { |
||
| 147 | this.funcao = funcao; |
||
| 148 | } |
||
| 149 | |||
| 150 | @Override |
||
| 151 | public int hashCode() { |
||
| 152 | if (getSequencial() != null) return super.hashCode(); |
||
| 153 | final int prime = 31; |
||
| 154 | int result = super.hashCode(); |
||
| 155 | result = prime * result |
||
| 156 | + ((dataExercicio == null) ? 0 : dataExercicio.hashCode()); |
||
| 157 | result = prime * result |
||
| 158 | + ((dataNomeacao == null) ? 0 : dataNomeacao.hashCode()); |
||
| 159 | result = prime * result |
||
| 160 | + ((dataPosse == null) ? 0 : dataPosse.hashCode()); |
||
| 161 | result = prime * result |
||
| 162 | + ((digitoMatricula == null) ? 0 : digitoMatricula.hashCode()); |
||
| 163 | result = prime * result + ((funcao == null) ? 0 : funcao.hashCode()); |
||
| 164 | result = prime |
||
| 165 | * result |
||
| 166 | + ((matriculaServidor == null) ? 0 : matriculaServidor |
||
| 167 | .hashCode()); |
||
| 168 | result = prime * result + ((ordem == null) ? 0 : ordem.hashCode()); |
||
| 169 | result = prime * result + ((orgao == null) ? 0 : orgao.hashCode()); |
||
| 170 | result = prime |
||
| 171 | * result |
||
| 172 | + ((situacaoServidor == null) ? 0 : situacaoServidor.hashCode()); |
||
| 173 | result = prime |
||
| 174 | * result |
||
| 175 | + ((tipoRegimeTrabalho == null) ? 0 : tipoRegimeTrabalho |
||
| 176 | .hashCode()); |
||
| 177 | return result; |
||
| 178 | } |
||
| 179 | @Override |
||
| 180 | public boolean equals(Object obj) { |
||
| 181 | if (getSequencial() != null) return super.equals(obj); |
||
| 182 | if (this == obj) |
||
| 183 | return true; |
||
| 184 | if (!super.equals(obj)) |
||
| 185 | return false; |
||
| 186 | if (getClass() != obj.getClass()) |
||
| 187 | return false; |
||
| 188 | ServidorDadoFuncionalMatricula other = (ServidorDadoFuncionalMatricula) obj; |
||
| 189 | if (dataExercicio == null) { |
||
| 190 | if (other.dataExercicio != null) |
||
| 191 | return false; |
||
| 192 | } else if (!dataExercicio.equals(other.dataExercicio)) |
||
| 193 | return false; |
||
| 194 | if (dataNomeacao == null) { |
||
| 195 | if (other.dataNomeacao != null) |
||
| 196 | return false; |
||
| 197 | } else if (!dataNomeacao.equals(other.dataNomeacao)) |
||
| 198 | return false; |
||
| 199 | if (dataPosse == null) { |
||
| 200 | if (other.dataPosse != null) |
||
| 201 | return false; |
||
| 202 | } else if (!dataPosse.equals(other.dataPosse)) |
||
| 203 | return false; |
||
| 204 | if (digitoMatricula == null) { |
||
| 205 | if (other.digitoMatricula != null) |
||
| 206 | return false; |
||
| 207 | } else if (!digitoMatricula.equals(other.digitoMatricula)) |
||
| 208 | return false; |
||
| 209 | if (funcao == null) { |
||
| 210 | if (other.funcao != null) |
||
| 211 | return false; |
||
| 212 | } else if (!funcao.equals(other.funcao)) |
||
| 213 | return false; |
||
| 214 | if (matriculaServidor == null) { |
||
| 215 | if (other.matriculaServidor != null) |
||
| 216 | return false; |
||
| 217 | } else if (!matriculaServidor.equals(other.matriculaServidor)) |
||
| 218 | return false; |
||
| 219 | if (ordem == null) { |
||
| 220 | if (other.ordem != null) |
||
| 221 | return false; |
||
| 222 | } else if (!ordem.equals(other.ordem)) |
||
| 223 | return false; |
||
| 224 | if (orgao == null) { |
||
| 225 | if (other.orgao != null) |
||
| 226 | return false; |
||
| 227 | } else if (!orgao.equals(other.orgao)) |
||
| 228 | return false; |
||
| 229 | if (situacaoServidor == null) { |
||
| 230 | if (other.situacaoServidor != null) |
||
| 231 | return false; |
||
| 232 | } else if (!situacaoServidor.equals(other.situacaoServidor)) |
||
| 233 | return false; |
||
| 234 | if (tipoRegimeTrabalho == null) { |
||
| 235 | if (other.tipoRegimeTrabalho != null) |
||
| 236 | return false; |
||
| 237 | } else if (!tipoRegimeTrabalho.equals(other.tipoRegimeTrabalho)) |
||
| 238 | return false; |
||
| 239 | return true; |
||
| 240 | } |
||
| 241 | |||
| 242 | } |