BrightSide Workbench Full Report + Source Code
VendorProspect.java
Go to the documentation of this file.
1 package org.turro.crm.entity;
2 
3 import java.util.Date;
4 import java.util.HashSet;
5 import java.util.Set;
6 import javax.persistence.*;
7 import org.turro.crm.db.CrmPU;
8 import org.turro.jpa.Dao;
9 import org.turro.jpa.entity.IDaoEntity;
10 
15 @Entity
16 public class VendorProspect implements java.io.Serializable, IDaoEntity {
17 
18  @Id
19  @GeneratedValue(strategy=GenerationType.IDENTITY)
20  @Column(name="IDENTIFIER")
21  private long id;
22 
23  @ManyToOne
24  private Vendor vendor;
25 
26  @ManyToOne
27  private Formula comission;
28 
29  @ManyToOne
30  private Formula alert;
31 
32  @Temporal(TemporalType.TIMESTAMP)
33  private java.util.Date prospectDate;
34 
35  @ManyToOne
36  private SaleProspect saleProspect;
37 
38  @OneToMany(mappedBy="vendorProspect", fetch = FetchType.LAZY, cascade=CascadeType.ALL, orphanRemoval=true)
39  private Set<SaleAction> saleActions = new HashSet<SaleAction>();
40 
41  public Formula getAlert() {
42  return alert;
43  }
44 
45  public void setAlert(Formula alert) {
46  this.alert = alert;
47  }
48 
49  public Formula getComission() {
50  return comission;
51  }
52 
53  public void setComission(Formula comission) {
54  this.comission = comission;
55  }
56 
57  public long getId() {
58  return id;
59  }
60 
61  public void setId(long id) {
62  this.id = id;
63  }
64 
65  public Date getProspectDate() {
66  return prospectDate;
67  }
68 
69  public void setProspectDate(Date prospectDate) {
70  this.prospectDate = prospectDate;
71  }
72 
73  public Set<SaleAction> getSaleActions() {
74  Dao dao = new CrmPU();
75  if(id > 0 && dao.isNotLoaded(saleActions)) {
76  saleActions = dao.lazyLoader(VendorProspect.class, this, "saleActions").saleActions;
77  }
78  return saleActions;
79  }
80 
81  public void setSaleActions(Set<SaleAction> saleActions) {
82  this.saleActions = saleActions;
83  }
84 
86  return saleProspect;
87  }
88 
89  public void setSaleProspect(SaleProspect saleProspect) {
90  this.saleProspect = saleProspect;
91  }
92 
93  public Vendor getVendor() {
94  return vendor;
95  }
96 
97  public void setVendor(Vendor vendor) {
98  this.vendor = vendor;
99  }
100 
101  /* IDaoEntity */
102 
103  @Override
104  public Object entityId() {
105  return id;
106  }
107 
108  @Override
109  public boolean isEmpty() {
110  return saleProspect == null || vendor == null ||
111  comission == null || alert == null;
112  }
113 
114  /* Helpers */
115 
116  public Set<SaleAction> getUpdatedSaleActions() {
117  Dao dao = new CrmPU();
118  if(id > 0) {
119  saleActions = dao.lazyLoader(VendorProspect.class, this, "saleActions").saleActions;
120  }
121  return saleActions;
122  }
123 
124 }
void setProspectDate(Date prospectDate)
void setSaleProspect(SaleProspect saleProspect)
void setComission(Formula comission)
void setSaleActions(Set< SaleAction > saleActions)
boolean isNotLoaded(Object o, String attribute)
Definition: Dao.java:216