Rev 106 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 106 | espaco | 1 | package br.com.ec.domain.model; |
| 2 | |||
| 3 | import java.io.Serializable; |
||
| 4 | import java.util.Set; |
||
| 5 | |||
| 6 | import javax.persistence.CascadeType; |
||
| 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.JoinColumn; |
||
| 13 | import javax.persistence.ManyToOne; |
||
| 14 | import javax.persistence.OneToMany; |
||
| 15 | import javax.persistence.SequenceGenerator; |
||
| 16 | import javax.persistence.Table; |
||
| 17 | import javax.validation.constraints.Size; |
||
| 18 | |||
| 19 | import org.hibernate.annotations.ForeignKey; |
||
| 20 | import org.hibernate.validator.constraints.NotEmpty; |
||
| 21 | |||
| 195 | espaco | 22 | import br.com.ec.core.interfaces.Alterar; |
| 23 | import br.com.ec.core.interfaces.Cadastrar; |
||
| 24 | import br.com.ec.core.util.StringUtil; |
||
| 106 | espaco | 25 | |
| 26 | @Entity |
||
| 27 | @Table(name="sec_unitopico", schema="sc_sec") |
||
| 28 | public class UniversidadeTopico implements Serializable { |
||
| 29 | |||
| 30 | private static final long serialVersionUID = 1L; |
||
| 31 | |||
| 32 | private Long sequencial; |
||
| 33 | private String descricao; |
||
| 34 | private String resumo; |
||
| 35 | private UniversidadeModulo modulo; |
||
| 36 | private Set<UniversidadeConteudo> conteudos; |
||
| 37 | private Integer ordenador; |
||
| 38 | private Boolean ativo; |
||
| 39 | |||
| 40 | @Id |
||
| 41 | @SequenceGenerator(name = "sq_unitopico") |
||
| 42 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
||
| 43 | @Column(name="seq_unitopico", nullable=false) |
||
| 44 | public Long getSequencial() { |
||
| 45 | return sequencial; |
||
| 46 | } |
||
| 47 | public void setSequencial(Long sequencial) { |
||
| 48 | this.sequencial = sequencial; |
||
| 49 | } |
||
| 50 | |||
| 51 | @Column(name="dsc_unitopico") |
||
| 52 | @Size(max = 120, message = "Limite de caracteres ultrapassado: Descrição") |
||
| 53 | @NotEmpty(message = "Parâmetro obrigatório não preenchido: Descrição", groups = {Cadastrar.class, Alterar.class}) |
||
| 54 | public String getDescricao() { |
||
| 55 | return descricao; |
||
| 56 | } |
||
| 57 | public void setDescricao(String descricao) { |
||
| 58 | this.descricao = StringUtil.setarUpperCaseComTrim(descricao); |
||
| 59 | } |
||
| 60 | |||
| 61 | @Column(name="dsc_resumo") |
||
| 62 | @Size(max = 400, message = "Limite de caracteres ultrapassado: Resumo") |
||
| 63 | public String getResumo() { |
||
| 64 | return resumo; |
||
| 65 | } |
||
| 66 | public void setResumo(String resumo) { |
||
| 67 | this.resumo = resumo; |
||
| 68 | } |
||
| 69 | |||
| 70 | @ManyToOne |
||
| 71 | @ForeignKey(name="fk_unitopico_unimodulo") |
||
| 72 | @JoinColumn(name = "seq_unimodulo", nullable = true) |
||
| 73 | public UniversidadeModulo getModulo() { |
||
| 74 | return modulo; |
||
| 75 | } |
||
| 76 | public void setModulo(UniversidadeModulo modulo) { |
||
| 77 | this.modulo = modulo; |
||
| 78 | } |
||
| 79 | |||
| 80 | @OneToMany(mappedBy="topico", cascade=CascadeType.ALL, orphanRemoval=true) |
||
| 81 | public Set<UniversidadeConteudo> getConteudos() { |
||
| 82 | return conteudos; |
||
| 83 | } |
||
| 84 | public void setConteudos(Set<UniversidadeConteudo> conteudos) { |
||
| 85 | this.conteudos = conteudos; |
||
| 86 | } |
||
| 87 | |||
| 88 | @Column(name="num_ordem") |
||
| 89 | public Integer getOrdenador() { |
||
| 90 | return ordenador; |
||
| 91 | } |
||
| 92 | public void setOrdenador(Integer ordenador) { |
||
| 93 | this.ordenador = ordenador; |
||
| 94 | } |
||
| 95 | |||
| 96 | @Column(name="ind_ativo", nullable=false) |
||
| 97 | public Boolean getAtivo() { |
||
| 98 | return ativo; |
||
| 99 | } |
||
| 100 | public void setAtivo(Boolean ativo) { |
||
| 101 | this.ativo = ativo; |
||
| 102 | } |
||
| 103 | |||
| 104 | } |