Rev 450 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 449 | blopes | 1 | package br.com.ec.domain.model; |
| 2 | |||
| 3 | import java.io.Serializable; |
||
| 4 | import java.util.Date; |
||
| 5 | import java.util.List; |
||
| 6 | |||
| 7 | import javax.persistence.Column; |
||
| 8 | import javax.persistence.Entity; |
||
| 9 | import javax.persistence.GeneratedValue; |
||
| 10 | import javax.persistence.GenerationType; |
||
| 11 | import javax.persistence.Id; |
||
| 12 | import javax.persistence.SequenceGenerator; |
||
| 13 | import javax.persistence.Table; |
||
| 14 | import javax.persistence.Transient; |
||
| 15 | import javax.validation.constraints.Size; |
||
| 16 | |||
| 17 | import org.hibernate.validator.constraints.NotEmpty; |
||
| 18 | |||
| 19 | import br.com.ec.core.interfaces.Alterar; |
||
| 20 | import br.com.ec.core.interfaces.Cadastrar; |
||
| 21 | import br.com.ec.core.util.StringUtil; |
||
| 22 | |||
| 462 | blopes | 23 | @Entity |
| 24 | @Table(name="sec_marca", schema="sc_sec") |
||
| 449 | blopes | 25 | public class Marca implements Serializable { |
| 26 | |||
| 27 | private static final long serialVersionUID = 1L; |
||
| 28 | |||
| 29 | private Long sequencial; |
||
| 30 | private String descricao; |
||
| 31 | private Integer ciclo; |
||
| 32 | private Boolean indicadorContagemSolicitada; |
||
| 33 | private Date dataContagemSolicitada; |
||
| 34 | private Boolean ativo; |
||
| 35 | |||
| 36 | private List<Modelo> listaModelos; |
||
| 462 | blopes | 37 | |
| 449 | blopes | 38 | @Id |
| 39 | @SequenceGenerator(name = "sec_marca_seq_marca_seq") //TODO: ALTERAR NOME DA SEQUENCE |
||
| 40 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
||
| 41 | @Column(name="seq_marca", nullable=false) |
||
| 42 | public Long getSequencial() { |
||
| 43 | return sequencial; |
||
| 44 | } |
||
| 45 | public void setSequencial(Long sequencial) { |
||
| 46 | this.sequencial = sequencial; |
||
| 47 | } |
||
| 48 | |||
| 49 | @Column(name="dsc_marca") |
||
| 50 | @Size(max = 255, message = "Limite de caracteres ultrapassado: Descrição") |
||
| 51 | @NotEmpty(message="Obrigatório informar a descrição", groups={Cadastrar.class, Alterar.class}) |
||
| 52 | public String getDescricao() { |
||
| 53 | return descricao; |
||
| 54 | } |
||
| 55 | public void setDescricao(String descricao) { |
||
| 56 | this.descricao = StringUtil.setarUpperCaseComTrim(descricao); |
||
| 57 | } |
||
| 58 | |||
| 59 | @Column(name="num_ciclo") |
||
| 60 | public Integer getCiclo() { |
||
| 61 | return ciclo; |
||
| 62 | } |
||
| 63 | public void setCiclo(Integer ciclo) { |
||
| 64 | this.ciclo = ciclo; |
||
| 65 | } |
||
| 66 | |||
| 67 | @Column(name="ind_contagem_solicitada", nullable=false) |
||
| 68 | public Boolean getIndicadorContagemSolicitada() { |
||
| 69 | return indicadorContagemSolicitada; |
||
| 70 | } |
||
| 71 | public void setIndicadorContagemSolicitada(Boolean indicadorContagemSolicitada) { |
||
| 72 | this.indicadorContagemSolicitada = indicadorContagemSolicitada; |
||
| 73 | } |
||
| 74 | |||
| 75 | @Column(name="dth_contagem_solicitada") |
||
| 76 | public Date getDataContagemSolicitada() { |
||
| 77 | return dataContagemSolicitada; |
||
| 78 | } |
||
| 79 | public void setDataContagemSolicitada(Date dataContagemSolicitada) { |
||
| 80 | this.dataContagemSolicitada = dataContagemSolicitada; |
||
| 81 | } |
||
| 82 | |||
| 83 | @Column(name="ind_ativo", nullable=false) |
||
| 84 | public Boolean getAtivo() { |
||
| 85 | return ativo; |
||
| 86 | } |
||
| 87 | public void setAtivo(Boolean ativo) { |
||
| 88 | this.ativo = ativo; |
||
| 89 | } |
||
| 90 | |||
| 91 | // @OneToMany(mappedBy="marca", fetch=FetchType.LAZY, orphanRemoval=false) |
||
| 92 | @Transient |
||
| 93 | public List<Modelo> getListaModelos() { |
||
| 94 | return listaModelos; |
||
| 95 | } |
||
| 96 | public void setListaModelos(List<Modelo> listaModelos) { |
||
| 97 | this.listaModelos = listaModelos; |
||
| 98 | } |
||
| 99 | |||
| 100 | @Override |
||
| 101 | public int hashCode() { |
||
| 102 | final int prime = 31; |
||
| 103 | int result = 1; |
||
| 104 | result = prime * result |
||
| 105 | + ((sequencial == null) ? 0 : sequencial.hashCode()); |
||
| 106 | return result; |
||
| 107 | } |
||
| 108 | |||
| 109 | @Override |
||
| 110 | public boolean equals(Object obj) { |
||
| 111 | if (this == obj) |
||
| 112 | return true; |
||
| 113 | if (obj == null) |
||
| 114 | return false; |
||
| 115 | if (getClass() != obj.getClass()) |
||
| 116 | return false; |
||
| 117 | Marca other = (Marca) obj; |
||
| 118 | if (sequencial == null) { |
||
| 119 | if (other.sequencial != null) |
||
| 120 | return false; |
||
| 121 | } else if (!sequencial.equals(other.sequencial)) |
||
| 122 | return false; |
||
| 123 | return true; |
||
| 124 | } |
||
| 125 | |||
| 126 | } |