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_pontocritico_cor_ptccor")
20 public class PontocriticoCorPtccor implements java.io.Serializable, PaiFilho {
21
22 private static final long serialVersionUID = 4558896026764299987L;
23
24 private PontocriticoCorPtccorPK id;
25 private Integer frequenciaEnvioEmailPtccor;
26 private Integer antecedenciaPrimEmailPtccor;
27 private String indAtivoEnvioEmailPtccor;
28 private PontoCriticoPtc pontoCriticoPtc;
29 private Cor cor;
30
31 public PontocriticoCorPtccor() {
32 }
33
34 public PontocriticoCorPtccor(PontocriticoCorPtccorPK id) {
35 this.id = id;
36 }
37
38 public PontocriticoCorPtccor(PontocriticoCorPtccorPK id, Integer frequenciaEnvioEmailPtccor, Integer antecedenciaPrimEmailPtccor, String indAtivoEnvioEmailPtccor, PontoCriticoPtc pontoCriticoPtc, Cor cor) {
39 this.id = id;
40 this.frequenciaEnvioEmailPtccor = frequenciaEnvioEmailPtccor;
41 this.antecedenciaPrimEmailPtccor = antecedenciaPrimEmailPtccor;
42 this.indAtivoEnvioEmailPtccor = indAtivoEnvioEmailPtccor;
43 this.pontoCriticoPtc = pontoCriticoPtc;
44 this.cor = cor;
45 }
46
47 @EmbeddedId
48 @AttributeOverrides( { @AttributeOverride(name = "codPtc", column = @Column(name = "COD_PTC", nullable = false, length = 10)), @AttributeOverride(name = "codCor", column = @Column(name = "COD_COR", nullable = false, length = 10)) })
49 public PontocriticoCorPtccorPK getId() {
50 return this.id;
51 }
52
53 public void setId(PontocriticoCorPtccorPK id) {
54 this.id = id;
55 }
56
57 @Column(name = "frequencia_envio_email_ptccor", length = 7)
58 public Integer getFrequenciaEnvioEmailPtccor() {
59 return this.frequenciaEnvioEmailPtccor;
60 }
61
62 public void setFrequenciaEnvioEmailPtccor(Integer frequenciaEnvioEmailPtccor) {
63 this.frequenciaEnvioEmailPtccor = frequenciaEnvioEmailPtccor;
64 }
65
66 @Column(name = "antecedencia_prim_email_ptccor", length = 7)
67 public Integer getAntecedenciaPrimEmailPtccor() {
68 return this.antecedenciaPrimEmailPtccor;
69 }
70
71 public void setAntecedenciaPrimEmailPtccor(Integer antecedenciaPrimEmailPtccor) {
72 this.antecedenciaPrimEmailPtccor = antecedenciaPrimEmailPtccor;
73 }
74
75 @Column(name = "ind_ativo_envio_email_ptccor", length = 1)
76 public String getIndAtivoEnvioEmailPtccor() {
77 return this.indAtivoEnvioEmailPtccor;
78 }
79
80 public void setIndAtivoEnvioEmailPtccor(String indAtivoEnvioEmailPtccor) {
81 this.indAtivoEnvioEmailPtccor = indAtivoEnvioEmailPtccor;
82 }
83
84 @ManyToOne(fetch = FetchType.LAZY)
85 @JoinColumn(name = "cod_ptc", insertable = false, updatable = false)
86 public PontoCriticoPtc getPontoCriticoPtc() {
87 return this.pontoCriticoPtc;
88 }
89
90 public void setPontoCriticoPtc(PontoCriticoPtc pontoCriticoPtc) {
91 this.pontoCriticoPtc = pontoCriticoPtc;
92 }
93
94 @ManyToOne(fetch = FetchType.LAZY)
95 @JoinColumn(name = "cod_cor", insertable = false, updatable = false)
96 public Cor getCor() {
97 return this.cor;
98 }
99
100 public void setCor(Cor cor) {
101 this.cor = cor;
102 }
103
104 public void atribuirPKPai() {
105 id = new PontocriticoCorPtccorPK();
106 id.setCodCor(this.getCor().getCodCor());
107 id.setCodPtc(this.getPontoCriticoPtc().getCodPtc());
108 }
109
110 }