Rev 625 | Rev 630 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 625 | blopes | 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.JoinColumn; |
||
| 12 | import javax.persistence.ManyToOne; |
||
| 13 | import javax.persistence.SequenceGenerator; |
||
| 14 | import javax.persistence.Table; |
||
| 15 | import javax.persistence.Transient; |
||
| 16 | import javax.validation.constraints.NotNull; |
||
| 17 | import javax.validation.constraints.Size; |
||
| 18 | |||
| 19 | import org.hibernate.annotations.ForeignKey; |
||
| 20 | |||
| 21 | import br.com.ec.core.generic.identidade.Identidade; |
||
| 22 | import br.com.ec.core.interfaces.Alterar; |
||
| 23 | import br.com.ec.core.interfaces.Cadastrar; |
||
| 24 | import br.com.ec.core.util.StringUtil; |
||
| 25 | |||
| 26 | @Entity |
||
| 27 | @Table(name="sec_nps_posvenda", schema="sc_sec") |
||
| 28 | public class NpsPosVenda implements Serializable, Identidade { |
||
| 29 | |||
| 30 | private static final long serialVersionUID = 1L; |
||
| 31 | |||
| 32 | private Long sequencial; |
||
| 33 | private PosVenda posVenda; |
||
| 34 | private String tipoNps; // A - ATENDIMENTO | P - PRODUTO |
||
| 35 | private Integer nota; |
||
| 36 | private String observacao; |
||
| 37 | private Date dataFinalizacao; |
||
| 38 | |||
| 39 | public NpsPosVenda() {} |
||
| 40 | |||
| 41 | @Override |
||
| 42 | @Transient |
||
| 43 | public Object getId() { |
||
| 44 | return this.getSequencial(); |
||
| 45 | } |
||
| 46 | @Override |
||
| 47 | public void setId(Object id) { |
||
| 48 | this.sequencial = (Long) id; |
||
| 49 | } |
||
| 50 | |||
| 51 | @Id |
||
| 52 | @SequenceGenerator(name = "sq_npsposvenda") |
||
| 53 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
||
| 629 | blopes | 54 | @Column(name="seq_npsposvenda", nullable=false) |
| 625 | blopes | 55 | public Long getSequencial() { |
| 56 | return sequencial; |
||
| 57 | } |
||
| 58 | public void setSequencial(Long sequencial) { |
||
| 59 | this.sequencial = sequencial; |
||
| 60 | } |
||
| 61 | |||
| 62 | @ManyToOne |
||
| 63 | @ForeignKey(name="fk_npsposvenda_posvenda") |
||
| 64 | @JoinColumn(name = "seq_posvenda", nullable = true) |
||
| 65 | public PosVenda getPosVenda() { |
||
| 66 | return posVenda; |
||
| 67 | } |
||
| 68 | public void setPosVenda(PosVenda posVenda) { |
||
| 69 | this.posVenda = posVenda; |
||
| 70 | } |
||
| 71 | |||
| 72 | @Column(name="tip_nps") |
||
| 73 | public String getTipoNps() { |
||
| 74 | return tipoNps; |
||
| 75 | } |
||
| 76 | public void setTipoNps(String tipoNps) { |
||
| 77 | this.tipoNps = tipoNps; |
||
| 78 | } |
||
| 79 | |||
| 80 | @NotNull(message = "Parâmetro obrigatório não preenchido: Nota do NPS", groups = {Cadastrar.class, Alterar.class}) |
||
| 81 | @Column(name="nota") |
||
| 82 | public Integer getNota() { |
||
| 83 | return nota; |
||
| 84 | } |
||
| 85 | public void setNota(Integer nota) { |
||
| 86 | this.nota = nota; |
||
| 87 | } |
||
| 88 | |||
| 89 | @NotNull(message = "Parâmetro obrigatório não preenchido: Data de finalização do NPS", groups = {Cadastrar.class, Alterar.class}) |
||
| 90 | @Column(name="dth_finalizacao") |
||
| 91 | public Date getDataFinalizacao() { |
||
| 92 | return dataFinalizacao; |
||
| 93 | } |
||
| 94 | public void setDataFinalizacao(Date dataFinalizacao) { |
||
| 95 | this.dataFinalizacao = dataFinalizacao; |
||
| 96 | } |
||
| 97 | |||
| 98 | @Column(name="dsc_observacao") |
||
| 99 | @Size(max = 1000, message = "Limite de caracteres ultrapassado: Comentário") |
||
| 100 | public String getObservacao() { |
||
| 101 | return observacao; |
||
| 102 | } |
||
| 103 | public void setObservacao(String observacao) { |
||
| 104 | this.observacao = StringUtil.setarUpperCaseComTrim(observacao); |
||
| 105 | } |
||
| 106 | |||
| 107 | } |