BrightSide Workbench Full Report + Source Code
org.turro.alliance.db.entities.AxContact Class Reference
Inheritance diagram for org.turro.alliance.db.entities.AxContact:
Collaboration diagram for org.turro.alliance.db.entities.AxContact:

Public Member Functions

ProcedenceId getContactId ()
 
void setContactId (ProcedenceId contactId)
 
String getId ()
 
String getName ()
 
void setName (String name)
 
String getEmail ()
 
void setEmail (String email)
 
String getPassdig ()
 
void setPassdig (String passdig)
 
String getCompany ()
 
void setCompany (String company)
 
String getPosition ()
 
void setPosition (String position)
 
String getFace ()
 
void setFace (String face)
 
String getCompanyFace ()
 
void setCompanyFace (String companyFace)
 
boolean isActive ()
 
void setActive (boolean active)
 
Iterable< IContactRelationgetBusinessRelations ()
 
Iterable< IContactRelationgetWorkerRelations ()
 
Object entityId ()
 
boolean isEmpty ()
 
String toJson ()
 
String toJson (Map< String, Object > properties)
 
int hashCode ()
 
boolean equals (Object obj)
 
- Public Member Functions inherited from org.turro.jpa.entity.IDaoEntity
default boolean isNew ()
 
default void prepareSave ()
 
default void prepareDelete ()
 
default void removeEmpties ()
 
default Collection< Collection > collections ()
 

Static Public Member Functions

static AxContact from (long memberId, String contactId)
 
static AxContact from (long memberId, ImporterRegister register)
 
static AxContact fromJson (JsonValue value)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 54 of file AxContact.java.

Member Function Documentation

◆ entityId()

Object org.turro.alliance.db.entities.AxContact.entityId ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 221 of file AxContact.java.

221  {
222  return contactId;
223  }

◆ equals()

boolean org.turro.alliance.db.entities.AxContact.equals ( Object  obj)

Definition at line 257 of file AxContact.java.

257  {
258  if (this == obj) {
259  return true;
260  }
261  if (obj == null) {
262  return false;
263  }
264  if (getClass() != obj.getClass()) {
265  return false;
266  }
267  final AxContact other = (AxContact) obj;
268  return Objects.equals(this.contactId, other.contactId);
269  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ from() [1/2]

static AxContact org.turro.alliance.db.entities.AxContact.from ( long  memberId,
ImporterRegister  register 
)
static

Definition at line 196 of file AxContact.java.

196  {
197  AxContact axc = new AxContact();
198  ProcedenceId id = new ProcedenceId();
199  id.setMemberId(memberId);
200  id.setEntityId(register.getString("contactId"));
201  axc.setContactId(id);
202  axc.setName(register.getString("name"));
203  axc.setEmail(register.getString("email"));
204  String pass = register.getString("pass");
205  if(!Strings.isBlank(pass)) try {
206  axc.setPassdig(Digest.sha256(ElephantContext.decrypt(pass)).hexString());
207  } catch (NoSuchAlgorithmException ex) {
208  Logger.getLogger(AxContact.class.getName()).log(Level.INFO, null, ex);
209  }
210  axc.setActive(!register.getBoolean("deactivated"));
211  axc.setFace(register.getString("face"));
212  axc.setCompany(register.getString("company"));
213  axc.setPosition(register.getString("position"));
214  axc.setCompanyFace(register.getString("companyFace"));
215  return axc;
216  }
Here is the call graph for this function:

◆ from() [2/2]

static AxContact org.turro.alliance.db.entities.AxContact.from ( long  memberId,
String  contactId 
)
static

Definition at line 162 of file AxContact.java.

162  {
163  if(!Strings.isBlank(contactId)) {
164  IContact contact = Contacts.getContactById(contactId);
165  if(contact.isValid()) {
166  AxContact axc = new AxContact();
167  ProcedenceId id = new ProcedenceId();
168  id.setMemberId(memberId);
169  id.setEntityId(contact.getId());
170  axc.setContactId(id);
171  axc.setName(contact.getName());
172  axc.setEmail(contact.getEmail());
173  String pass = ((Contact) contact.getContact()).getPass1();
174  if(!Strings.isBlank(pass)) try {
175  axc.setPassdig(Digest.sha256(ElephantContext.decrypt(pass)).hexString());
176  } catch (NoSuchAlgorithmException ex) {
177  Logger.getLogger(AxContact.class.getName()).log(Level.INFO, null, ex);
178  }
179  axc.setActive(!contact.isDeactivated());
180  String serverURL = ElephantContext.getServerUrl("http");
181  axc.setFace(Strings.isBlank(contact.getFace()) ? null : serverURL + contact.getFace());
182  IContactRelation cr = contact.getCompanyRelations().getCompanyRelation();
183  if(cr != null) {
184  IContact business = cr.getRelatedIContact();
185  BusinessRelation br = (BusinessRelation) cr.getRelation();
186  axc.setCompany(business.getName());
187  axc.setPosition(Phrases.start(cr.getDatesString()).add(br.getDescription()).toString());
188  axc.setCompanyFace(Strings.isBlank(business.getFace()) ? null : serverURL + business.getFace());
189  }
190  return axc;
191  }
192  }
193  return null;
194  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromJson()

static AxContact org.turro.alliance.db.entities.AxContact.fromJson ( JsonValue  value)
static

Definition at line 243 of file AxContact.java.

243  {
244  return IJSONizable.fromJson(value.toString(), AxContact.class);
245  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBusinessRelations()

Iterable<IContactRelation> org.turro.alliance.db.entities.AxContact.getBusinessRelations ( )

Definition at line 146 of file AxContact.java.

146  {
147  return List.of(new ContactRelationAdapter(true, new AllianceContact(this).getBusiness()));
148  }
Here is the caller graph for this function:

◆ getCompany()

String org.turro.alliance.db.entities.AxContact.getCompany ( )

Definition at line 104 of file AxContact.java.

104  {
105  return company;
106  }

◆ getCompanyFace()

String org.turro.alliance.db.entities.AxContact.getCompanyFace ( )

Definition at line 128 of file AxContact.java.

128  {
129  return companyFace;
130  }

◆ getContactId()

ProcedenceId org.turro.alliance.db.entities.AxContact.getContactId ( )

Definition at line 68 of file AxContact.java.

68  {
69  return contactId;
70  }
Here is the caller graph for this function:

◆ getEmail()

String org.turro.alliance.db.entities.AxContact.getEmail ( )

Definition at line 88 of file AxContact.java.

88  {
89  return email;
90  }
Here is the caller graph for this function:

◆ getFace()

String org.turro.alliance.db.entities.AxContact.getFace ( )

Definition at line 120 of file AxContact.java.

120  {
121  return face;
122  }
Here is the caller graph for this function:

◆ getId()

String org.turro.alliance.db.entities.AxContact.getId ( )

Definition at line 76 of file AxContact.java.

76  {
77  return id;
78  }

◆ getName()

String org.turro.alliance.db.entities.AxContact.getName ( )

Definition at line 80 of file AxContact.java.

80  {
81  return name;
82  }
Here is the caller graph for this function:

◆ getPassdig()

String org.turro.alliance.db.entities.AxContact.getPassdig ( )

Definition at line 96 of file AxContact.java.

96  {
97  return passdig;
98  }

◆ getPosition()

String org.turro.alliance.db.entities.AxContact.getPosition ( )

Definition at line 112 of file AxContact.java.

112  {
113  return position;
114  }
Here is the caller graph for this function:

◆ getWorkerRelations()

Iterable<IContactRelation> org.turro.alliance.db.entities.AxContact.getWorkerRelations ( )

Definition at line 150 of file AxContact.java.

150  {
151  return SqlClause.select("c").from("AxContact c")
152  .where().equal("c.company", company)
153  .and().equal("c.contactId.memberId", contactId.getMemberId())
154  .dao(new AlliancePU())
155  .resultList(AxContact.class)
156  .stream().map(c -> (IContactRelation) new ContactRelationAdapter(true, new AllianceContact(c)))
157  .toList();
158  }
Here is the caller graph for this function:

◆ hashCode()

int org.turro.alliance.db.entities.AxContact.hashCode ( )

Definition at line 250 of file AxContact.java.

250  {
251  int hash = 7;
252  hash = 83 * hash + Objects.hashCode(this.contactId);
253  return hash;
254  }

◆ isActive()

boolean org.turro.alliance.db.entities.AxContact.isActive ( )

Definition at line 136 of file AxContact.java.

136  {
137  return active;
138  }

◆ isEmpty()

boolean org.turro.alliance.db.entities.AxContact.isEmpty ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 226 of file AxContact.java.

226  {
227  return contactId.isEmpty() ||
228  Strings.isBlank(name);
229  }

◆ setActive()

void org.turro.alliance.db.entities.AxContact.setActive ( boolean  active)

Definition at line 140 of file AxContact.java.

140  {
141  this.active = active;
142  }
Here is the caller graph for this function:

◆ setCompany()

void org.turro.alliance.db.entities.AxContact.setCompany ( String  company)

Definition at line 108 of file AxContact.java.

108  {
109  this.company = company;
110  }
Here is the caller graph for this function:

◆ setCompanyFace()

void org.turro.alliance.db.entities.AxContact.setCompanyFace ( String  companyFace)

Definition at line 132 of file AxContact.java.

132  {
133  this.companyFace = companyFace;
134  }
Here is the caller graph for this function:

◆ setContactId()

void org.turro.alliance.db.entities.AxContact.setContactId ( ProcedenceId  contactId)

Definition at line 72 of file AxContact.java.

72  {
73  this.contactId = contactId;
74  }
Here is the caller graph for this function:

◆ setEmail()

void org.turro.alliance.db.entities.AxContact.setEmail ( String  email)

Definition at line 92 of file AxContact.java.

92  {
93  this.email = email;
94  }
Here is the caller graph for this function:

◆ setFace()

void org.turro.alliance.db.entities.AxContact.setFace ( String  face)

Definition at line 124 of file AxContact.java.

124  {
125  this.face = face;
126  }
Here is the caller graph for this function:

◆ setName()

void org.turro.alliance.db.entities.AxContact.setName ( String  name)

Definition at line 84 of file AxContact.java.

84  {
85  this.name = name;
86  }
Here is the caller graph for this function:

◆ setPassdig()

void org.turro.alliance.db.entities.AxContact.setPassdig ( String  passdig)

Definition at line 100 of file AxContact.java.

100  {
101  this.passdig = passdig;
102  }
Here is the caller graph for this function:

◆ setPosition()

void org.turro.alliance.db.entities.AxContact.setPosition ( String  position)

Definition at line 116 of file AxContact.java.

116  {
117  this.position = position;
118  }
Here is the caller graph for this function:

◆ toJson() [1/2]

String org.turro.alliance.db.entities.AxContact.toJson ( )

Definition at line 234 of file AxContact.java.

234  {
235  return toJson(this);
236  }
Here is the caller graph for this function:

◆ toJson() [2/2]

String org.turro.alliance.db.entities.AxContact.toJson ( Map< String, Object >  properties)

Definition at line 239 of file AxContact.java.

239  {
240  return toJson(this, properties);
241  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: