19 package org.turro.alliance.db.entities;
21 import java.io.Serializable;
22 import java.security.NoSuchAlgorithmException;
23 import java.util.List;
25 import java.util.Objects;
26 import java.util.logging.Level;
27 import java.util.logging.Logger;
28 import javax.json.JsonValue;
29 import javax.persistence.EmbeddedId;
30 import javax.persistence.Entity;
31 import org.turro.string.Phrases;
32 import org.turro.string.Strings;
33 import org.hibernate.annotations.Formula;
34 import org.turro.action.Contacts;
35 import org.turro.alliance.contact.AllianceContact;
36 import org.turro.alliance.contact.ContactRelationAdapter;
37 import org.turro.alliance.db.AlliancePU;
38 import org.turro.contacts.BusinessRelation;
39 import org.turro.contacts.Contact;
40 import org.turro.crypto.Digest;
41 import org.turro.elephant.context.ElephantContext;
42 import org.turro.importer.ImporterRegister;
43 import org.turro.jpa.entity.IDaoEntity;
44 import org.turro.json.IJSONizable;
45 import org.turro.plugin.contacts.IContact;
46 import org.turro.plugin.contacts.IContactRelation;
47 import org.turro.sql.SqlClause;
58 @Formula(
"concat(entityId,'##',memberId)")
61 private String name, email;
62 private String passdig;
63 private String company, position;
64 private String face, companyFace;
66 private boolean active;
73 this.contactId = contactId;
101 this.passdig = passdig;
109 this.company = company;
117 this.position = position;
133 this.companyFace = companyFace;
141 this.active = active;
151 return SqlClause.select(
"c").from(
"AxContact c")
152 .where().equal(
"c.company", company)
153 .and().equal(
"c.contactId.memberId", contactId.getMemberId())
163 if(!Strings.isBlank(contactId)) {
168 id.setMemberId(memberId);
169 id.setEntityId(contact.
getId());
174 if(!Strings.isBlank(pass))
try {
176 }
catch (NoSuchAlgorithmException ex) {
199 id.setMemberId(memberId);
200 id.setEntityId(
register.getString(
"contactId"));
202 axc.
setName(
register.getString(
"name"));
203 axc.
setEmail(
register.getString(
"email"));
204 String pass =
register.getString(
"pass");
205 if(!Strings.isBlank(pass))
try {
207 }
catch (NoSuchAlgorithmException ex) {
210 axc.
setActive(!
register.getBoolean(
"deactivated"));
211 axc.
setFace(
register.getString(
"face"));
212 axc.
setCompany(
register.getString(
"company"));
227 return contactId.isEmpty() ||
228 Strings.isBlank(name);
239 public String
toJson(Map<String, Object> properties) {
240 return toJson(
this, properties);
252 hash = 83 * hash + Objects.hashCode(this.contactId);
264 if (getClass() != obj.getClass()) {
268 return Objects.
equals(this.contactId, other.contactId);
static String getServerUrl(String scheme)
static byte[] decrypt(byte[] value)