19 package org.turro.alliance.contact;
21 import java.io.Serializable;
22 import java.util.Collections;
23 import java.util.List;
24 import java.util.Locale;
25 import java.util.Objects;
26 import java.util.Optional;
27 import org.turro.string.Strings;
28 import org.turro.alliance.db.AlliancePU;
29 import org.turro.alliance.db.entities.AxContact;
30 import org.turro.alliance.db.entities.ProcedenceId;
31 import org.turro.annotation.ElephantContact;
32 import org.turro.collections.KeyValueMap;
33 import org.turro.elephant.context.Application;
34 import org.turro.elephant.security.IUser;
35 import org.turro.entities.Faces;
36 import org.turro.plugin.contacts.IContact;
37 import org.turro.plugin.contacts.IProfile;
38 import org.turro.plugin.contacts.IRelations;
39 import org.turro.security.ContactPermissions;
40 import org.turro.security.FlatPermissions;
41 import org.turro.sql.SqlClause;
42 import org.turro.util.CompareUtil;
180 return business !=
null ? List.of(getBusiness()) :
null;
215 return contact !=
null;
220 throw new UnsupportedOperationException(
"Not supported yet.");
260 return Collections.EMPTY_LIST;
267 if(_permissions ==
null) {
291 if(contactId !=
null) {
365 return SqlClause.select(
"distinct c.contactId.memberId, c.company, c.companyFace").from(
"AxContact c")
367 .resultList(Object[].
class)
375 return Collections.EMPTY_LIST;
380 return Collections.EMPTY_LIST;
385 return Collections.EMPTY_LIST;
394 public void syndicate(String syndicationName,
boolean syndicate) {
499 public boolean validate(String login, String password) {
515 return impersonate(email);
553 if(
object instanceof String) {
562 return CompareUtil.compare(getId(), o.
getId());
566 this.contact = contact;
567 this.business = createBusiness(contact);
570 private AxContact createBusiness(AxContact contact) {
571 return contact ==
null ? null : createBusiness(contact.getContactId().getMemberId(), contact.getCompany(), contact.getCompanyFace());
574 private AxContact createBusiness(
long memberId, String name, String face) {
575 if(!Strings.isBlank(name)) {
576 AxContact b =
new AxContact();
577 ProcedenceId
id =
new ProcedenceId();
578 id.setEntityId(name +
"#c");
579 id.setMemberId(memberId);
591 hash = 13 * hash + Objects.hashCode(this.contact);
603 if (getClass() != obj.getClass()) {
607 return Objects.
equals(this.contact, other.contact);
static ProcedenceId from(String id)
IConstructor getConstructor()
static final String CONNECTOR_EMAIL