1 package ecar.pojo;
2
3
4
5 import javax.persistence.AttributeOverride;
6 import javax.persistence.AttributeOverrides;
7 import javax.persistence.Column;
8 import javax.persistence.EmbeddedId;
9 import javax.persistence.Entity;
10 import javax.persistence.FetchType;
11 import javax.persistence.JoinColumn;
12 import javax.persistence.ManyToOne;
13 import javax.persistence.Table;
14
15
16
17
18 @Entity
19 @Table(name = "tb_tipo_acomp_grp_acesso")
20 public class TipoAcompGrpAcesso implements java.io.Serializable, PaiFilho {
21
22 private static final long serialVersionUID = -2312432640912468501L;
23
24 private TipoAcompGrpAcessoId id;
25 private SisAtributoSatb sisAtributoSatb;
26 private TipoAcompanhamentoTa tipoAcompanhamentoTa;
27 private String acessoInclusao;
28 private Integer separarPorOrgao;
29
30 public TipoAcompGrpAcesso() {
31 }
32
33 public TipoAcompGrpAcesso(TipoAcompGrpAcessoId id, SisAtributoSatb sisAtributoSatb, TipoAcompanhamentoTa tipoAcompanhamentoTa) {
34 this.id = id;
35 this.sisAtributoSatb = sisAtributoSatb;
36 this.tipoAcompanhamentoTa = tipoAcompanhamentoTa;
37 }
38
39 public TipoAcompGrpAcesso(TipoAcompGrpAcessoId id, SisAtributoSatb sisAtributoSatb, TipoAcompanhamentoTa tipoAcompanhamentoTa, String acessoInclusao, Integer separarPorOrgao) {
40 this.id = id;
41 this.sisAtributoSatb = sisAtributoSatb;
42 this.tipoAcompanhamentoTa = tipoAcompanhamentoTa;
43 this.acessoInclusao = acessoInclusao;
44 this.separarPorOrgao = separarPorOrgao;
45 }
46
47 public TipoAcompGrpAcesso(SisAtributoSatb sisAtributoSatb, TipoAcompanhamentoTa tipoAcompanhamentoTa) {
48 this.id = new TipoAcompGrpAcessoId(sisAtributoSatb.getCodSatb(),tipoAcompanhamentoTa.getCodTa());
49 }
50
51 @EmbeddedId
52 @AttributeOverrides( { @AttributeOverride(name = "codTa", column = @Column(name = "cod_ta", nullable = false)), @AttributeOverride(name = "codSatb", column = @Column(name = "cod_satb", nullable = false)) })
53 public TipoAcompGrpAcessoId getId() {
54 return this.id;
55 }
56
57 public void setId(TipoAcompGrpAcessoId id) {
58 this.id = id;
59 }
60
61 @ManyToOne(fetch = FetchType.LAZY)
62 @JoinColumn(name = "cod_satb", nullable = false, insertable = false, updatable = false)
63 public SisAtributoSatb getSisAtributoSatb() {
64 return this.sisAtributoSatb;
65 }
66
67 public void setSisAtributoSatb(SisAtributoSatb sisAtributoSatb) {
68 this.sisAtributoSatb = sisAtributoSatb;
69 }
70
71 @ManyToOne(fetch = FetchType.LAZY)
72 @JoinColumn(name = "cod_ta", nullable = false, insertable = false, updatable = false)
73 public TipoAcompanhamentoTa getTipoAcompanhamentoTa() {
74 return this.tipoAcompanhamentoTa;
75 }
76
77 public void setTipoAcompanhamentoTa(TipoAcompanhamentoTa tipoAcompanhamentoTa) {
78 this.tipoAcompanhamentoTa = tipoAcompanhamentoTa;
79 }
80
81 @Column(name = "acesso_inclusao", length = 1)
82 public String getAcessoInclusao() {
83 return this.acessoInclusao;
84 }
85
86 public void setAcessoInclusao(String acessoInclusao) {
87 this.acessoInclusao = acessoInclusao;
88 }
89
90 @Column(name = "separar_por_orgao")
91 public Integer getSepararPorOrgao() {
92 return this.separarPorOrgao;
93 }
94
95 public void setSepararPorOrgao(Integer separarPorOrgao) {
96 this.separarPorOrgao = separarPorOrgao;
97 }
98
99 public void atribuirPKPai() {
100 id = new TipoAcompGrpAcessoId();
101 id.setCodSatb(this.getSisAtributoSatb().getCodSatb());
102 id.setCodTa(this.getTipoAcompanhamentoTa().getCodTa());
103 }
104
105 }