Go to most recent revision | Details | 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 | |||
| 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.JoinColumn; |
||
| 11 | import javax.persistence.ManyToOne; |
||
| 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.annotations.ForeignKey; |
||
| 18 | import org.hibernate.validator.constraints.NotEmpty; |
||
| 19 | |||
| 20 | import br.com.ec.domain.model.tipos.TipoUniversidadeConteudo; |
||
| 21 | import br.edu.cesmac.core.interfaces.Alterar; |
||
| 22 | import br.edu.cesmac.core.interfaces.Cadastrar; |
||
| 23 | import br.edu.cesmac.core.util.StringUtil; |
||
| 24 | |||
| 25 | @Entity |
||
| 26 | @Table(name="sec_uniconteudo", schema="sc_sec") |
||
| 27 | public class UniversidadeConteudo implements Serializable { |
||
| 28 | |||
| 29 | private static final long serialVersionUID = 1L; |
||
| 30 | |||
| 31 | private Long sequencial; |
||
| 32 | private String titulo; |
||
| 33 | private String resumo; |
||
| 34 | private String descricao; |
||
| 35 | private String tipoConteudo; |
||
| 36 | private UniversidadeTopico topico; |
||
| 37 | private Integer ordenador; |
||
| 38 | private Boolean ativo; |
||
| 39 | |||
| 40 | @Id |
||
| 41 | @SequenceGenerator(name = "sq_uniconteudo") |
||
| 42 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
||
| 43 | @Column(name="seq_uniconteudo", 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_titulo", nullable=false) |
||
| 52 | @Size(max = 120, message = "Limite de caracteres ultrapassado: Descrição") |
||
| 53 | @NotEmpty(message = "Parâmetro obrigatório não preenchido: Título", groups = {Cadastrar.class, Alterar.class}) |
||
| 54 | public String getTitulo() { |
||
| 55 | return titulo; |
||
| 56 | } |
||
| 57 | public void setTitulo(String titulo) { |
||
| 58 | this.titulo = StringUtil.setarUpperCaseComTrim(titulo); |
||
| 59 | } |
||
| 60 | |||
| 61 | @Column(name="dsc_resumo") |
||
| 62 | @Size(max = 1000, 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 | @Column(name="dsc_conteudo") |
||
| 71 | @Size(max = 200, message = "Limite de caracteres ultrapassado: Conteúdo") |
||
| 72 | public String getDescricao() { |
||
| 73 | return descricao; |
||
| 74 | } |
||
| 75 | public void setDescricao(String descricao) { |
||
| 76 | this.descricao = descricao; |
||
| 77 | } |
||
| 78 | |||
| 79 | @Column(name="tip_uniconteudo", nullable=false) |
||
| 80 | @NotEmpty(message = "Parâmetro obrigatório não preenchido: Tipo do conteúdo", groups = {Cadastrar.class, Alterar.class}) |
||
| 81 | public String getTipoConteudo() { |
||
| 82 | return tipoConteudo; |
||
| 83 | } |
||
| 84 | public void setTipoConteudo(String tipoConteudo) { |
||
| 85 | this.tipoConteudo = tipoConteudo; |
||
| 86 | } |
||
| 87 | @Transient |
||
| 88 | public String getTipoConteudoDescricao() { |
||
| 89 | return TipoUniversidadeConteudo.parse(getTipoConteudo()).getDescricao(); |
||
| 90 | } |
||
| 91 | @Transient |
||
| 92 | public Boolean tipoConteudoTexto() { |
||
| 93 | return getTipoConteudo().equals(TipoUniversidadeConteudo.TEXTO.getValor()); |
||
| 94 | } |
||
| 95 | @Transient |
||
| 96 | public Boolean tipoConteudoVideo() { |
||
| 97 | return getTipoConteudo().equals(TipoUniversidadeConteudo.VIDEO.getValor()); |
||
| 98 | } |
||
| 99 | @Transient |
||
| 100 | public Boolean tipoConteudoLink() { |
||
| 101 | return getTipoConteudo().equals(TipoUniversidadeConteudo.LINK.getValor()); |
||
| 102 | } |
||
| 103 | @Transient |
||
| 104 | public Boolean tipoConteudoArquivoPdf() { |
||
| 105 | return getTipoConteudo().equals(TipoUniversidadeConteudo.ARQUIVO_PDF.getValor()); |
||
| 106 | } |
||
| 107 | |||
| 108 | @ManyToOne |
||
| 109 | @ForeignKey(name="fk_uniconteudo_unitopico") |
||
| 110 | @JoinColumn(name = "seq_unitopico", nullable = true) |
||
| 111 | public UniversidadeTopico getTopico() { |
||
| 112 | return topico; |
||
| 113 | } |
||
| 114 | public void setTopico(UniversidadeTopico topico) { |
||
| 115 | this.topico = topico; |
||
| 116 | } |
||
| 117 | |||
| 118 | @Column(name="num_ordem") |
||
| 119 | public Integer getOrdenador() { |
||
| 120 | return ordenador; |
||
| 121 | } |
||
| 122 | public void setOrdenador(Integer ordenador) { |
||
| 123 | this.ordenador = ordenador; |
||
| 124 | } |
||
| 125 | |||
| 126 | @Column(name="ind_ativo", nullable=false) |
||
| 127 | public Boolean getAtivo() { |
||
| 128 | return ativo; |
||
| 129 | } |
||
| 130 | public void setAtivo(Boolean ativo) { |
||
| 131 | this.ativo = ativo; |
||
| 132 | } |
||
| 133 | |||
| 134 | } |