1 package org.turro.crm.entity;
3 import java.util.Collection;
4 import java.util.HashSet;
7 import javax.persistence.*;
8 import org.turro.string.Strings;
9 import org.turro.action.Contacts;
10 import org.turro.jpa.entity.IDaoEntity;
11 import org.turro.plugin.contacts.IContact;
21 @GeneratedValue(strategy=GenerationType.IDENTITY)
22 @Column(name=
"IDENTIFIER")
27 private String idContact;
29 @JoinTable(name=
"Customer_ActivitySector")
30 @ManyToMany(fetch = FetchType.EAGER, targetEntity =
ActivitySector.class)
31 private Set<ActivitySector> activitySectors =
new HashSet<ActivitySector>();
33 @JoinTable(name=
"Customer_CustomerSector")
34 @ManyToMany(fetch = FetchType.EAGER, targetEntity =
ActivitySector.class)
35 private Set<ActivitySector> customerSectors =
new HashSet<ActivitySector>();
37 @ManyToMany(fetch = FetchType.EAGER, targetEntity =
Technology.class)
38 private Set<Technology> technologies =
new HashSet<Technology>();
40 @OneToMany(mappedBy =
"customer", fetch = FetchType.EAGER, cascade=CascadeType.ALL, orphanRemoval=
true)
41 private Set<CustomerOwner> ownedBy =
new HashSet<CustomerOwner>();
43 @OneToMany(mappedBy =
"customer", fetch = FetchType.EAGER, cascade=CascadeType.ALL, orphanRemoval=
true)
44 private Set<SaleProspect> saleProspects =
new HashSet<SaleProspect>();
47 return activitySectors;
51 this.activitySectors = activitySectors;
55 return customerSectors;
59 this.customerSectors = customerSectors;
75 this.idContact = idContact;
93 this.ownedBy = ownedBy;
101 this.saleProspects = saleProspects;
109 this.technologies = technologies;
121 return Strings.isBlank(idContact);
126 return List.of(ownedBy);
131 private transient IContact _contact;
134 if(_contact ==
null) {
142 idContact = _contact !=
null ? _contact.
getId() :
null;
143 name = _contact !=
null ? _contact.
getName() :
null;
146 private void resetIContact() {
Set< ActivitySector > getActivitySectors()
void setOwnedBy(Set< CustomerOwner > ownedBy)
Set< CustomerOwner > getOwnedBy()
void setCustomerSectors(Set< ActivitySector > customerSectors)
Set< SaleProspect > getSaleProspects()
Set< Technology > getTechnologies()
Set< ActivitySector > getCustomerSectors()
void setIContact(IContact contact)
void setName(String name)
Collection< Collection > collections()
void setTechnologies(Set< Technology > technologies)
void setSaleProspects(Set< SaleProspect > saleProspects)
void setIdContact(String idContact)
void setActivitySectors(Set< ActivitySector > activitySectors)