1 package org.turro.crm.entity;
3 import java.util.ArrayList;
4 import java.util.Collection;
6 import java.util.HashSet;
9 import javax.persistence.*;
10 import org.turro.string.Strings;
11 import org.turro.action.Contacts;
12 import org.turro.crm.db.CrmPU;
13 import org.turro.crm.zul.sale.ProspectStageWrapper;
14 import org.turro.crm.zul.sale.SaleActionSet;
15 import org.turro.jpa.Dao;
16 import org.turro.jpa.entity.IDaoEntity;
17 import org.turro.plugin.contacts.IContact;
27 @GeneratedValue(strategy=GenerationType.IDENTITY)
28 @Column(name=
"IDENTIFIER")
33 private String description;
35 private double budget;
44 @Temporal(TemporalType.TIMESTAMP)
45 private java.util.Date prospectDate;
47 @Temporal(TemporalType.TIMESTAMP)
48 private java.util.Date closingDate;
53 @OneToMany(mappedBy=
"saleProspect", fetch = FetchType.EAGER, cascade=CascadeType.ALL, orphanRemoval=
true)
54 private Set<VendorProspect> vendorProspects =
new HashSet<VendorProspect>();
56 @ElementCollection(fetch=FetchType.EAGER)
57 private Set<String> attendees =
new HashSet<String>();
64 this.attendees = attendees;
80 this.campaign = campaign;
88 this.closingDate = closingDate;
96 this.customer = customer;
104 this.description = description;
120 this.prospectDate = prospectDate;
140 return vendorProspects;
144 this.vendorProspects = vendorProspects;
156 return Strings.isBlank(description) || customer ==
null;
161 return List.of(vendorProspects);
167 return Strings.truncateAndWarn(description, 50) +
168 (customer ==
null ?
"" :
" (" + customer.getName() +
")");
177 return (
set !=
null && !
set.
isEmpty()) ?
set.last() :
null;
183 return dao.lazyLoader(
SaleProspect.class,
this,
"vendorProspects").vendorProspects;
185 return vendorProspects;
195 ArrayList<IContact> list =
new ArrayList<IContact>();
196 for(String s : attendees) {
206 if(c.isValid()) attendees.add(c.getId());
237 if(vp.getVendor() !=
null && vp.getVendor().getId() == vendor.
getId()) {
Set< VendorProspect > getUpdatedVendorProspects()
void setStage(ProspectStage stage)
void setIAttendees(Collection< IContact > contacts)
void setClosingDate(Date closingDate)
Set< String > getAttendees()
void setCampaign(Campaign campaign)
void addCampaignVendor(CampaignVendor campaignVendor)
String getFullDescription()
void setType(ProspectType type)
Collection< Collection > collections()
Set< VendorProspect > getVendorProspects()
void setCustomer(Customer customer)
void setDescription(String description)
VendorProspect existsVendor(Vendor vendor)
void setProspectDate(Date prospectDate)
Collection< IContact > getIAttendees()
void setVendorProspects(Set< VendorProspect > vendorProspects)
void setAttendees(Set< String > attendees)
ProspectStageWrapper getStageWrapper()
void addCustomerOwner(CustomerOwner customerOwner)
void setBudget(double budget)
SaleAction getLastSaleAction()
SaleActionSet getSaleActions()
void setSaleProspect(SaleProspect saleProspect)
void setVendor(Vendor vendor)
void setAlert(Formula alert)
void setComission(Formula comission)