Rev 170 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 170 | espaco | 1 | package br.com.ec.domain.model; |
| 2 | |||
| 3 | import java.io.Serializable; |
||
| 4 | |||
| 5 | import javax.persistence.Column; |
||
| 6 | import javax.persistence.Entity; |
||
| 7 | import javax.persistence.GeneratedValue; |
||
| 8 | import javax.persistence.GenerationType; |
||
| 9 | import javax.persistence.Id; |
||
| 10 | import javax.persistence.Table; |
||
| 11 | import javax.validation.constraints.Size; |
||
| 12 | |||
| 195 | espaco | 13 | import br.com.ec.core.util.StringUtil; |
| 170 | espaco | 14 | |
| 15 | @Entity |
||
| 16 | @Table(name="sec_papel", schema="sc_sec") |
||
| 17 | public class Papel implements Serializable { |
||
| 18 | |||
| 19 | private static final long serialVersionUID = 1L; |
||
| 20 | |||
| 21 | private Integer codigo; |
||
| 22 | private String descricao; |
||
| 23 | |||
| 24 | @Id |
||
| 25 | @GeneratedValue(strategy=GenerationType.IDENTITY) |
||
| 26 | @Column(name="cod_papel", nullable=false) |
||
| 27 | public Integer getCodigo() { |
||
| 28 | return codigo; |
||
| 29 | } |
||
| 30 | |||
| 31 | public void setCodigo(Integer codigo) { |
||
| 32 | this.codigo = codigo; |
||
| 33 | } |
||
| 34 | |||
| 35 | @Column(name="dsc_papel") |
||
| 36 | @Size(max = 120, message = "Limite de caracteres ultrapassado: Descrição") |
||
| 37 | public String getDescricao() { |
||
| 38 | return descricao; |
||
| 39 | } |
||
| 40 | |||
| 41 | public void setDescricao(String descricao) { |
||
| 42 | this.descricao = StringUtil.setarUpperCaseComTrim(descricao); |
||
| 43 | } |
||
| 44 | |||
| 45 | @Override |
||
| 46 | public int hashCode() { |
||
| 47 | final int prime = 31; |
||
| 48 | int result = 1; |
||
| 49 | result = prime * result + ((codigo == null) ? 0 : codigo.hashCode()); |
||
| 50 | return result; |
||
| 51 | } |
||
| 52 | |||
| 53 | @Override |
||
| 54 | public boolean equals(Object obj) { |
||
| 55 | if (this == obj) |
||
| 56 | return true; |
||
| 57 | if (obj == null) |
||
| 58 | return false; |
||
| 59 | if (getClass() != obj.getClass()) |
||
| 60 | return false; |
||
| 61 | Papel other = (Papel) obj; |
||
| 62 | if (codigo == null) { |
||
| 63 | if (other.codigo != null) |
||
| 64 | return false; |
||
| 65 | } else if (!codigo.equals(other.codigo)) |
||
| 66 | return false; |
||
| 67 | return true; |
||
| 68 | } |
||
| 69 | |||
| 70 | } |