1 package ecar.pojo;
2
3
4
5 import java.util.HashSet;
6 import java.util.Set;
7 import javax.persistence.Column;
8 import javax.persistence.Entity;
9 import javax.persistence.FetchType;
10 import javax.persistence.GeneratedValue;
11 import javax.persistence.Id;
12 import javax.persistence.JoinColumn;
13 import javax.persistence.JoinTable;
14 import javax.persistence.ManyToMany;
15 import javax.persistence.OneToMany;
16 import javax.persistence.Table;
17 import org.hibernate.annotations.Cascade;
18 import org.hibernate.annotations.CascadeType;
19 import org.hibernate.annotations.GenericGenerator;
20
21
22
23
24 @Entity
25 @Table(name = "TB_OPCAO_OPC")
26 public class OpcaoOpc implements java.io.Serializable {
27
28 private Long codOpcao;
29 private String descricaoOpc;
30 private Integer nivelOpc;
31 private String programaOpc;
32 private String indSiteOpc;
33 private String indAdminOpc;
34 private Set<OpcaoMenuOpcm> opcaoMenuOpcmsByCodOpcPai = new HashSet<OpcaoMenuOpcm>(0);
35 private Set<OpcaoMenuOpcm> opcaoMenuOpcmsByCodOpcFilho = new HashSet<OpcaoMenuOpcm>(0);
36 private Set<PerfilPfl> opcaoPerfilOpcps = new HashSet<PerfilPfl>(0);
37
38 public OpcaoOpc() {
39 }
40
41 public OpcaoOpc(String descricaoOpc, Integer nivelOpc, String programaOpc, String indSiteOpc, String indAdminOpc, Set<OpcaoMenuOpcm> opcaoMenuOpcmsByCodOpcPai, Set<OpcaoMenuOpcm> opcaoMenuOpcmsByCodOpcFilho, Set<PerfilPfl> opcaoPerfilOpcps) {
42 this.descricaoOpc = descricaoOpc;
43 this.nivelOpc = nivelOpc;
44 this.programaOpc = programaOpc;
45 this.indSiteOpc = indSiteOpc;
46 this.indAdminOpc = indAdminOpc;
47 this.opcaoMenuOpcmsByCodOpcPai = opcaoMenuOpcmsByCodOpcPai;
48 this.opcaoMenuOpcmsByCodOpcFilho = opcaoMenuOpcmsByCodOpcFilho;
49 this.opcaoPerfilOpcps = opcaoPerfilOpcps;
50 }
51
52 @GenericGenerator(name = "generator", strategy = "increment")
53 @Id
54 @GeneratedValue(generator = "generator")
55 @Column(name = "COD_OPCAO", nullable = false)
56 public Long getCodOpcao() {
57 return this.codOpcao;
58 }
59
60 public void setCodOpcao(Long codOpcao) {
61 this.codOpcao = codOpcao;
62 }
63
64 @Column(name = "DESCRICAO_OPC", length = 30)
65 public String getDescricaoOpc() {
66 return this.descricaoOpc;
67 }
68
69 public void setDescricaoOpc(String descricaoOpc) {
70 this.descricaoOpc = descricaoOpc;
71 }
72
73 @Column(name = "NIVEL_OPC", length = 5)
74 public Integer getNivelOpc() {
75 return this.nivelOpc;
76 }
77
78 public void setNivelOpc(Integer nivelOpc) {
79 this.nivelOpc = nivelOpc;
80 }
81
82 @Column(name = "PROGRAMA_OPC", length = 100)
83 public String getProgramaOpc() {
84 return this.programaOpc;
85 }
86
87 public void setProgramaOpc(String programaOpc) {
88 this.programaOpc = programaOpc;
89 }
90
91 @Column(name = "IND_SITE_OPC", length = 1)
92 public String getIndSiteOpc() {
93 return this.indSiteOpc;
94 }
95
96 public void setIndSiteOpc(String indSiteOpc) {
97 this.indSiteOpc = indSiteOpc;
98 }
99
100 @Column(name = "IND_ADMIN_OPC", length = 1)
101 public String getIndAdminOpc() {
102 return this.indAdminOpc;
103 }
104
105 public void setIndAdminOpc(String indAdminOpc) {
106 this.indAdminOpc = indAdminOpc;
107 }
108
109 @OneToMany(fetch = FetchType.LAZY, mappedBy = "opcaoOpcByCodOpcPai")
110 public Set<OpcaoMenuOpcm> getOpcaoMenuOpcmsByCodOpcPai() {
111 return this.opcaoMenuOpcmsByCodOpcPai;
112 }
113
114 public void setOpcaoMenuOpcmsByCodOpcPai(Set<OpcaoMenuOpcm> opcaoMenuOpcmsByCodOpcPai) {
115 this.opcaoMenuOpcmsByCodOpcPai = opcaoMenuOpcmsByCodOpcPai;
116 }
117
118 @OneToMany(fetch = FetchType.LAZY, mappedBy = "opcaoOpcByCodOpcFilho")
119 public Set<OpcaoMenuOpcm> getOpcaoMenuOpcmsByCodOpcFilho() {
120 return this.opcaoMenuOpcmsByCodOpcFilho;
121 }
122
123 public void setOpcaoMenuOpcmsByCodOpcFilho(Set<OpcaoMenuOpcm> opcaoMenuOpcmsByCodOpcFilho) {
124 this.opcaoMenuOpcmsByCodOpcFilho = opcaoMenuOpcmsByCodOpcFilho;
125 }
126
127 @ManyToMany(fetch = FetchType.LAZY)
128 @JoinTable(name = "TB_OPCAO_PERFIL_OPCP", joinColumns = { @JoinColumn(name = "COD_OPCAO", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "COD_PFL", nullable = false, updatable = false) })
129 @Cascade( { CascadeType.SAVE_UPDATE })
130 public Set<PerfilPfl> getOpcaoPerfilOpcps() {
131 return this.opcaoPerfilOpcps;
132 }
133
134 public void setOpcaoPerfilOpcps(Set<PerfilPfl> opcaoPerfilOpcps) {
135 this.opcaoPerfilOpcps = opcaoPerfilOpcps;
136 }
137
138 }