Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | espaco | 1 | package br.com.ec.domain.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.GeneratedValue; |
||
| 9 | import javax.persistence.GenerationType; |
||
| 10 | import javax.persistence.Id; |
||
| 11 | import javax.persistence.Table; |
||
| 12 | import javax.validation.constraints.NotNull; |
||
| 13 | |||
| 14 | import org.hibernate.validator.constraints.NotEmpty; |
||
| 15 | |||
| 16 | import br.edu.cesmac.core.interfaces.Alterar; |
||
| 17 | import br.edu.cesmac.core.interfaces.Cadastrar; |
||
| 18 | import br.edu.cesmac.core.util.StringUtil; |
||
| 19 | |||
| 20 | @Entity |
||
| 21 | @Table(name="sec_vigencia", schema="sc_sec") |
||
| 22 | public class Vigencia implements Serializable { |
||
| 23 | |||
| 24 | private static final long serialVersionUID = 1L; |
||
| 25 | |||
| 26 | private Long sequencial; |
||
| 27 | private String descricao; |
||
| 28 | private Date dataInicio; |
||
| 29 | private Date dataFim; |
||
| 30 | |||
| 31 | @Id |
||
| 32 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
||
| 33 | @Column(name="seq_vigencia", nullable=false) |
||
| 34 | public Long getSequencial() { |
||
| 35 | return sequencial; |
||
| 36 | } |
||
| 37 | public void setSequencial(Long sequencial) { |
||
| 38 | this.sequencial = sequencial; |
||
| 39 | } |
||
| 40 | |||
| 41 | @NotNull(message="Obrigatório informar a descrição", groups={Cadastrar.class, Alterar.class}) |
||
| 42 | @NotEmpty(message="Obrigatório informar a descrição", groups={Cadastrar.class, Alterar.class}) |
||
| 43 | @Column(name="dsc_vigencia") |
||
| 44 | public String getDescricao() { |
||
| 45 | return descricao; |
||
| 46 | } |
||
| 47 | public void setDescricao(String descricao) { |
||
| 48 | this.descricao = StringUtil.setarUpperCase(descricao); |
||
| 49 | } |
||
| 50 | |||
| 51 | @NotNull(message="Obrigatório informar a data de início", groups={Cadastrar.class, Alterar.class}) |
||
| 52 | @Column(name="dth_inicio") |
||
| 53 | public Date getDataInicio() { |
||
| 54 | return dataInicio; |
||
| 55 | } |
||
| 56 | public void setDataInicio(Date dataInicio) { |
||
| 57 | this.dataInicio = dataInicio; |
||
| 58 | } |
||
| 59 | |||
| 60 | @NotNull(message="Obrigatório informar a data de fim", groups={Cadastrar.class, Alterar.class}) |
||
| 61 | @Column(name="dth_fim") |
||
| 62 | public Date getDataFim() { |
||
| 63 | return dataFim; |
||
| 64 | } |
||
| 65 | public void setDataFim(Date dataFim) { |
||
| 66 | this.dataFim = dataFim; |
||
| 67 | } |
||
| 68 | |||
| 69 | @Override |
||
| 70 | public int hashCode() { |
||
| 71 | final int prime = 31; |
||
| 72 | int result = 1; |
||
| 73 | result = prime * result + ((sequencial == null) ? 0 : sequencial.hashCode()); |
||
| 74 | return result; |
||
| 75 | } |
||
| 76 | |||
| 77 | @Override |
||
| 78 | public boolean equals(Object obj) { |
||
| 79 | if (this == obj) |
||
| 80 | return true; |
||
| 81 | if (obj == null) |
||
| 82 | return false; |
||
| 83 | if (getClass() != obj.getClass()) |
||
| 84 | return false; |
||
| 85 | Vigencia other = (Vigencia) obj; |
||
| 86 | if (sequencial == null) { |
||
| 87 | if (other.sequencial != null) |
||
| 88 | return false; |
||
| 89 | } else if (!sequencial.equals(other.sequencial)) |
||
| 90 | return false; |
||
| 91 | return true; |
||
| 92 | } |
||
| 93 | |||
| 94 | } |