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.EmbeddedId; |
||
| 8 | import javax.persistence.Entity; |
||
| 9 | import javax.persistence.JoinColumn; |
||
| 10 | import javax.persistence.JoinColumns; |
||
| 11 | import javax.persistence.ManyToOne; |
||
| 12 | import javax.persistence.Table; |
||
| 13 | import javax.persistence.Temporal; |
||
| 14 | import javax.persistence.TemporalType; |
||
| 15 | |||
| 16 | import br.gov.al.saude.framework.core.util.VerificadorUtil; |
||
| 17 | import br.gov.al.saude.srv.model.embedded.ServidorProgramacaoFeriasId; |
||
| 18 | |||
| 19 | @Entity |
||
| 20 | @Table(name="srv_programferias_servdadofunc", schema="sc_srv") |
||
| 21 | public class ServidorProgramacaoFerias implements Serializable{ |
||
| 22 | |||
| 23 | private static final long serialVersionUID = 1L; |
||
| 24 | |||
| 25 | private ServidorProgramacaoFeriasId servidorProgramacaoFeriasId = new ServidorProgramacaoFeriasId(); |
||
| 26 | private ServidorDadoFuncional servidorDadoFuncional; |
||
| 27 | private ProgramacaoFerias programacaoFerias; |
||
| 28 | private Date dataInicio; |
||
| 29 | private Date dataFim; |
||
| 30 | |||
| 31 | @EmbeddedId |
||
| 32 | public ServidorProgramacaoFeriasId getServidorProgramacaoFeriasId() { |
||
| 33 | return servidorProgramacaoFeriasId; |
||
| 34 | } |
||
| 35 | |||
| 36 | public void setServidorProgramacaoFeriasId( |
||
| 37 | ServidorProgramacaoFeriasId servidorProgramacaoFeriasId) { |
||
| 38 | this.servidorProgramacaoFeriasId = servidorProgramacaoFeriasId; |
||
| 39 | } |
||
| 40 | |||
| 41 | @ManyToOne |
||
| 42 | @JoinColumn(name="seq_servidor_dadofuncional", referencedColumnName="seq_servidor_dadofuncional", nullable=false, insertable=false, updatable=false) |
||
| 43 | public ServidorDadoFuncional getServidorDadoFuncional() { |
||
| 44 | return servidorDadoFuncional; |
||
| 45 | } |
||
| 46 | |||
| 47 | public void setServidorDadoFuncional(ServidorDadoFuncional servidorDadoFuncional) { |
||
| 48 | if(VerificadorUtil.naoEstaNulo(servidorDadoFuncional)) { |
||
| 49 | servidorProgramacaoFeriasId.setSequencialServidorDadoFuncional(servidorDadoFuncional.getSequencial()); |
||
| 50 | } |
||
| 51 | this.servidorDadoFuncional = servidorDadoFuncional; |
||
| 52 | } |
||
| 53 | |||
| 54 | @ManyToOne |
||
| 55 | @JoinColumns({ |
||
| 56 | @JoinColumn(name="cod_unidade", referencedColumnName="cod_unidade", nullable=false, insertable=false, updatable=false), |
||
| 57 | @JoinColumn(name="num_ano_programacao", referencedColumnName="num_ano_programacao", nullable=false, insertable=false, updatable=false) |
||
| 58 | }) |
||
| 59 | public ProgramacaoFerias getProgramacaoFerias() { |
||
| 60 | return programacaoFerias; |
||
| 61 | } |
||
| 62 | |||
| 63 | public void setProgramacaoFerias(ProgramacaoFerias programacaoFerias) { |
||
| 64 | if(VerificadorUtil.naoEstaNulo(programacaoFerias)) { |
||
| 65 | servidorProgramacaoFeriasId.setCodigoUnidade(programacaoFerias.getCodigoUnidade()); |
||
| 66 | servidorProgramacaoFeriasId.setNumeroAnoProgramacao(programacaoFerias.getNumeroAnoProgramacao()); |
||
| 67 | } |
||
| 68 | this.programacaoFerias = programacaoFerias; |
||
| 69 | } |
||
| 70 | |||
| 71 | @Temporal(TemporalType.DATE) |
||
| 72 | @Column(name="dat_inicio", nullable=false) |
||
| 73 | public Date getDataInicio() { |
||
| 74 | return dataInicio; |
||
| 75 | } |
||
| 76 | |||
| 77 | public void setDataInicio(Date dataInicio) { |
||
| 78 | this.dataInicio = dataInicio; |
||
| 79 | } |
||
| 80 | |||
| 81 | @Temporal(TemporalType.DATE) |
||
| 82 | @Column(name="dat_fim", nullable=false) |
||
| 83 | public Date getDataFim() { |
||
| 84 | return dataFim; |
||
| 85 | } |
||
| 86 | |||
| 87 | public void setDataFim(Date dataFim) { |
||
| 88 | this.dataFim = dataFim; |
||
| 89 | } |
||
| 90 | |||
| 91 | @Override |
||
| 92 | public int hashCode() { |
||
| 93 | final int prime = 31; |
||
| 94 | int result = 1; |
||
| 95 | result = prime |
||
| 96 | * result |
||
| 97 | + ((servidorProgramacaoFeriasId == null) ? 0 |
||
| 98 | : servidorProgramacaoFeriasId.hashCode()); |
||
| 99 | return result; |
||
| 100 | } |
||
| 101 | |||
| 102 | @Override |
||
| 103 | public boolean equals(Object obj) { |
||
| 104 | if (this == obj) |
||
| 105 | return true; |
||
| 106 | if (obj == null) |
||
| 107 | return false; |
||
| 108 | if (!(obj instanceof ServidorProgramacaoFerias)) |
||
| 109 | return false; |
||
| 110 | ServidorProgramacaoFerias other = (ServidorProgramacaoFerias) obj; |
||
| 111 | if (servidorProgramacaoFeriasId == null) { |
||
| 112 | if (other.servidorProgramacaoFeriasId != null) |
||
| 113 | return false; |
||
| 114 | } else if (!servidorProgramacaoFeriasId |
||
| 115 | .equals(other.servidorProgramacaoFeriasId)) |
||
| 116 | return false; |
||
| 117 | return true; |
||
| 118 | } |
||
| 119 | |||
| 120 | |||
| 121 | |||
| 122 | } |