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.OneToMany; |
||
| 13 | import javax.persistence.OrderBy; |
||
| 14 | import javax.persistence.SequenceGenerator; |
||
| 15 | import javax.persistence.Table; |
||
| 16 | import javax.validation.constraints.Size; |
||
| 17 | |||
| 18 | import org.hibernate.validator.constraints.NotEmpty; |
||
| 19 | |||
| 195 | espaco | 20 | import br.com.ec.core.interfaces.Alterar; |
| 21 | import br.com.ec.core.interfaces.Cadastrar; |
||
| 22 | import br.com.ec.core.util.StringUtil; |
||
| 106 | espaco | 23 | |
| 24 | @Entity |
||
| 25 | @Table(name="sec_unimodulo", schema="sc_sec") |
||
| 26 | public class UniversidadeModulo implements Serializable, Cloneable { |
||
| 27 | |||
| 28 | private static final long serialVersionUID = 1L; |
||
| 29 | |||
| 30 | private Long sequencial; |
||
| 31 | private String descricao; |
||
| 32 | private String resumo; |
||
| 33 | private Integer ordenador; |
||
| 34 | private Set<UniversidadeModuloPerfil> perfisComAcesso; |
||
| 35 | private Set<UniversidadeTopico> topicos; |
||
| 36 | private Boolean ativo; |
||
| 37 | |||
| 38 | @Id |
||
| 39 | @SequenceGenerator(name = "sq_unimodulo") |
||
| 40 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
||
| 41 | @Column(name="seq_unimodulo", 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_unimodulo", nullable=false) |
||
| 50 | @Size(max = 120, message = "Limite de caracteres ultrapassado: Descrição") |
||
| 51 | @NotEmpty(message = "Parâmetro obrigatório não preenchido: 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="dsc_resumo") |
||
| 60 | @Size(max = 400, message = "Limite de caracteres ultrapassado: Resumo") |
||
| 61 | public String getResumo() { |
||
| 62 | return resumo; |
||
| 63 | } |
||
| 64 | public void setResumo(String resumo) { |
||
| 65 | this.resumo = resumo; |
||
| 66 | } |
||
| 67 | |||
| 68 | @Column(name="num_ordem") |
||
| 69 | public Integer getOrdenador() { |
||
| 70 | return ordenador; |
||
| 71 | } |
||
| 72 | public void setOrdenador(Integer ordenador) { |
||
| 73 | this.ordenador = ordenador; |
||
| 74 | } |
||
| 75 | |||
| 76 | @OneToMany(mappedBy="perfil", cascade=CascadeType.ALL, orphanRemoval=true) |
||
| 77 | public Set<UniversidadeModuloPerfil> getPerfisComAcesso() { |
||
| 78 | return perfisComAcesso; |
||
| 79 | } |
||
| 80 | public void setPerfisComAcesso(Set<UniversidadeModuloPerfil> perfisComAcesso) { |
||
| 81 | this.perfisComAcesso = perfisComAcesso; |
||
| 82 | } |
||
| 83 | |||
| 84 | @OrderBy("ordenador") |
||
| 85 | @OneToMany(mappedBy="modulo", cascade=CascadeType.ALL, orphanRemoval=true) |
||
| 86 | public Set<UniversidadeTopico> getTopicos() { |
||
| 87 | return topicos; |
||
| 88 | } |
||
| 89 | public void setTopicos(Set<UniversidadeTopico> topicos) { |
||
| 90 | this.topicos = topicos; |
||
| 91 | } |
||
| 92 | |||
| 93 | @Column(name="ind_ativo", nullable=false) |
||
| 94 | public Boolean getAtivo() { |
||
| 95 | return ativo; |
||
| 96 | } |
||
| 97 | public void setAtivo(Boolean ativo) { |
||
| 98 | this.ativo = ativo; |
||
| 99 | } |
||
| 100 | |||
| 101 | @Override |
||
| 102 | public int hashCode() { |
||
| 103 | final int prime = 31; |
||
| 104 | int result = 1; |
||
| 105 | result = prime * result + ((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 | UniversidadeModulo other = (UniversidadeModulo) 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 | /***************************************************************/ |
||
| 127 | |||
| 128 | |||
| 129 | |||
| 130 | } |