BrightSide Workbench Full Report + Source Code
org.turro.contacts.util.DefaultContact Class Reference
Inheritance diagram for org.turro.contacts.util.DefaultContact:
Collaboration diagram for org.turro.contacts.util.DefaultContact:

Public Member Functions

 DefaultContact ()
 
 DefaultContact (Object object)
 
 DefaultContact (Contact contact)
 
Object loadById (String id)
 
Object loadByLogin (String login)
 
Object loadLogged (Application app)
 
Object getContact ()
 
void setContact (Object contact)
 
String getId ()
 
String getGlobalId ()
 
String getGrouping ()
 
String getDeepGrouping ()
 
String getLogin ()
 
String getName ()
 
String getFriendly ()
 
String getFormal ()
 
String getFullName ()
 
String getTradeName ()
 
String getEmail ()
 
Locale getLocale ()
 
String getConnector (String id)
 
List< String > getConnectorList (String id)
 
IRelations getCompanyRelations ()
 
IRelations getStaffRelations ()
 
List< IContactgetRelations (String id)
 
List< IContactgetRelations ()
 
IContact getBusiness ()
 
List< IContactgetBusinessList ()
 
List< IContactgetCoworkers ()
 
List< IContactgetCoworkers (IContact business)
 
boolean isInBusiness (IContact worker)
 
void setConnector (String id, String value)
 
void setName (String value)
 
void setPassword (String newValue, String repeatValue)
 
void applyChanges ()
 
boolean isValid ()
 
boolean checkPassword (String password)
 
boolean checkPassword2 (String password)
 
String getCommentValue (String key)
 
Object getObject (String key)
 
void setObject (String key, Serializable value)
 
boolean isWebUser ()
 
boolean isWebapp ()
 
boolean isUserMenu ()
 
boolean isDeactivated ()
 
List< String > getSyndications ()
 
FlatPermissions getPermissions ()
 
void resetPermissions ()
 
IUser getAsUser ()
 
boolean acceptsLang (String lang)
 
List< IContactloadByPartialName (String name)
 
List< IContactloadByPartialName (String name, KeyValueMap kvm)
 
IContact loadByName (String name)
 
IContact loadByEmail (String email)
 
void setAttribute (String key, Object value)
 
Object getAttribute (String key)
 
List< IContactgetBySyndication (String syndication)
 
List< IContactgetByRole (String role)
 
List< IContactgetByGrouping (String grouping)
 
List< IContactgetByGrouping (List< String > groupings)
 
List< IContactgetCompanies ()
 
List< IContactgetCenters ()
 
List< IContactgetHHRR ()
 
List< IContactgetStudents ()
 
void startContactFromValues (KeyValueMap values)
 
void syndicate (String syndicationName, boolean syndicate)
 
String getFace ()
 
Faces getFaces ()
 
IProfile getProfile ()
 
boolean isAdmin ()
 
boolean isUser ()
 
boolean isCompany ()
 
boolean isCenter ()
 
boolean isInternal ()
 
boolean isWorker ()
 
boolean isStudent ()
 
boolean isResponsible ()
 
boolean isHHRR ()
 
boolean isWorker (IContact business)
 
boolean isStudent (IContact business)
 
boolean isResponsible (IContact business)
 
boolean isHHRR (IContact business)
 
boolean isInNetworking ()
 
boolean isInPremiumNetworking ()
 
String getLangTranslator ()
 
boolean isActor (String actor)
 
boolean isActor (Object entity, String actor)
 
IContact getLogged ()
 
boolean isOutsider ()
 
boolean accepts (Object object)
 
int hashCode ()
 
boolean equals (Object obj)
 
int compareTo (IContact o)
 
boolean validate (String login, String password)
 
boolean validate2 (String password2)
 
boolean impersonate (String login)
 
boolean impersonateByEmail (String email)
 
void reload ()
 
boolean isThisUser (String id)
 
String getProperty (String key)
 
boolean isInRole (String role)
 
boolean hasAnyRoleKey (String role)
 
- Public Member Functions inherited from org.turro.plugin.contacts.IContact
void setApplication (Application app)
 

Static Public Member Functions

static String fullName (String contactId)
 

Protected Attributes

Contact contact = null
 
boolean superUser = false
 

Additional Inherited Members

- Static Public Attributes inherited from org.turro.elephant.security.IUser
static final String CONNECTOR_EMAIL = "Email"
 
static final String CONNECTOR_TRADE = "TradeName"
 
static final String CONNECTOR_FISCAL = "FiscalName"
 
static final String CONNECTOR_EMAIL_LOGIN = "EmailLogin"
 
static final String ADDRESS_FISCAL = "Fiscal"
 
static final String LOGGED_USER = "xp_user"
 
static final String INTERNAL_SIGNIN = "InternalSignIn"
 

Detailed Description

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

Definition at line 75 of file DefaultContact.java.

Constructor & Destructor Documentation

◆ DefaultContact() [1/3]

org.turro.contacts.util.DefaultContact.DefaultContact ( )

Definition at line 79 of file DefaultContact.java.

79  {
80  }

◆ DefaultContact() [2/3]

org.turro.contacts.util.DefaultContact.DefaultContact ( Object  object)

Definition at line 82 of file DefaultContact.java.

82  {
83  this.contact = (Contact) object;
84  }

◆ DefaultContact() [3/3]

org.turro.contacts.util.DefaultContact.DefaultContact ( Contact  contact)

Definition at line 86 of file DefaultContact.java.

86  {
87  this.contact = contact;
88  }

Member Function Documentation

◆ accepts()

boolean org.turro.contacts.util.DefaultContact.accepts ( Object  object)

Implements org.turro.plugin.contacts.IContact.

Definition at line 797 of file DefaultContact.java.

797  {
798  if(object instanceof String) {
799  return !CompoundId.isOutsiderId((String) object);
800  } else {
801  return object instanceof Contact;
802  }
803  }
Here is the call graph for this function:

◆ acceptsLang()

boolean org.turro.contacts.util.DefaultContact.acceptsLang ( String  lang)

Implements org.turro.plugin.contacts.IContact.

Definition at line 479 of file DefaultContact.java.

479  {
480  return Locales.checkLanguage(contact.getLocale(), lang);
481  }
Here is the call graph for this function:

◆ applyChanges()

void org.turro.contacts.util.DefaultContact.applyChanges ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 362 of file DefaultContact.java.

362  {
363  try {
364  new org.turro.contacts.form.ContactWrapper(contact).save();
365  } catch (Exception ex) {
366  Logger.getLogger(DefaultContact.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
367  }
368  }
Here is the call graph for this function:

◆ checkPassword()

boolean org.turro.contacts.util.DefaultContact.checkPassword ( String  password)

Implements org.turro.plugin.contacts.IContact.

Definition at line 376 of file DefaultContact.java.

376  {
377  try {
378  return ElephantContext.encrypt(password).equals(contact.getPass1());
379  } catch (Exception ex) {
380  Logger.getLogger(DefaultContact.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
381  }
382  return false;
383  }
Here is the call graph for this function:

◆ checkPassword2()

boolean org.turro.contacts.util.DefaultContact.checkPassword2 ( String  password)

Definition at line 385 of file DefaultContact.java.

385  {
386  try {
387  return ElephantContext.encrypt(password).equals(contact.getPass2());
388  } catch (Exception ex) {
389  Logger.getLogger(DefaultContact.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
390  }
391  return false;
392  }
Here is the call graph for this function:

◆ compareTo()

int org.turro.contacts.util.DefaultContact.compareTo ( IContact  o)

Definition at line 840 of file DefaultContact.java.

840  {
841  return CompareUtil.compare(getId(), o.getId());
842  }
Here is the call graph for this function:

◆ equals()

boolean org.turro.contacts.util.DefaultContact.equals ( Object  obj)
Returns
True if object is an IUser with the same login

Implements org.turro.elephant.security.IUser.

Definition at line 816 of file DefaultContact.java.

816  {
817  if (!this.isValid()) {
818  return false;
819  }
820  if (this == obj) {
821  return true;
822  }
823  if (obj == null) {
824  return false;
825  }
826  if (!(obj instanceof IContact)) {
827  return false;
828  }
829  final IContact other = (IContact) obj;
830  if (!other.isValid()) {
831  return false;
832  }
833  if (!Objects.equals(this.getId(), other.getId())) {
834  return false;
835  }
836  return true;
837  }
Here is the call graph for this function:

◆ fullName()

static String org.turro.contacts.util.DefaultContact.fullName ( String  contactId)
static

Definition at line 516 of file DefaultContact.java.

516  {
517  Object o = new ContactsPU().getSingleResult(
518  "select name from Contact contact " +
519  "where contact.id = ?",
520  new Object[] {
521  contactId
522  });
523  return (String) o;
524  }
Here is the call graph for this function:

◆ getAsUser()

IUser org.turro.contacts.util.DefaultContact.getAsUser ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 474 of file DefaultContact.java.

474  {
475  return this;
476  }

◆ getAttribute()

Object org.turro.contacts.util.DefaultContact.getAttribute ( String  key)

Implements org.turro.plugin.contacts.IContact.

Definition at line 532 of file DefaultContact.java.

532  {
533  return contact.getAttribute(key);
534  }
Object getAttribute(String key)
Definition: Contact.java:553
Here is the call graph for this function:

◆ getBusiness()

IContact org.turro.contacts.util.DefaultContact.getBusiness ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 269 of file DefaultContact.java.

269  {
270  if(contact != null) {
271  Contact b = contact.getBusiness();
272  if(b != null) {
273  return b.getIContact();
274  }
275  }
276  return null;
277  }
Here is the call graph for this function:

◆ getBusinessList()

List<IContact> org.turro.contacts.util.DefaultContact.getBusinessList ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 280 of file DefaultContact.java.

280  {
281  org.turro.plugin.contacts.ContactList list = new org.turro.plugin.contacts.ContactList();
282  if(contact != null) {
283  for(Contact c : contact.getBusinessList()) {
284  if(!c.getId().equals(contact.getId())) {
285  list.add(c.getIContact());
286  }
287  }
288  }
289  return list;
290  }
List< Contact > getBusinessList()
Definition: Contact.java:632
Here is the call graph for this function:

◆ getByGrouping() [1/2]

List<IContact> org.turro.contacts.util.DefaultContact.getByGrouping ( List< String >  groupings)

Implements org.turro.plugin.contacts.IContact.

Definition at line 577 of file DefaultContact.java.

577  {
578  ArrayList<IContact> list = new ArrayList<>();
579  if(groupings != null && !groupings.isEmpty()) {
580  WhereClause wc = new WhereClause();
581  wc.addClause("select contact from Contact as contact");
582  wc.addClause("where contact.grouping in (:groupings)");
583  wc.addNamedValue("groupings", groupings);
584  for(Contact c : (List<Contact>) new ContactsPU().getResultList(wc)) {
585  list.add(c.getIContact());
586  }
587  }
588  return list;
589  }
Here is the call graph for this function:

◆ getByGrouping() [2/2]

List<IContact> org.turro.contacts.util.DefaultContact.getByGrouping ( String  grouping)

Implements org.turro.plugin.contacts.IContact.

Definition at line 572 of file DefaultContact.java.

572  {
573  return getByGrouping(Collections.singletonList(grouping));
574  }
List< IContact > getByGrouping(String grouping)

◆ getByRole()

List<IContact> org.turro.contacts.util.DefaultContact.getByRole ( String  role)

Implements org.turro.plugin.contacts.IContact.

Definition at line 556 of file DefaultContact.java.

556  {
557  ArrayList<IContact> list = new ArrayList<>();
558  if(!Strings.isBlank(role)) {
559  List<String> syndicationNames = List.copyOf(Permissions.getSecurityGroupIdsBy(role));
560  WhereClause wc = new WhereClause();
561  wc.addClause("select distinct syndication.contact from Syndication as syndication");
562  wc.addClause("where syndication.name in (:syndicationNames)");
563  wc.addNamedValue("syndicationNames", syndicationNames);
564  for(Contact c : (List<Contact>) new ContactsPU().getResultList(wc)) {
565  list.add(c.getIContact());
566  }
567  }
568  return list;
569  }
Here is the call graph for this function:

◆ getBySyndication()

List<IContact> org.turro.contacts.util.DefaultContact.getBySyndication ( String  syndication)

Implements org.turro.plugin.contacts.IContact.

Definition at line 537 of file DefaultContact.java.

537  {
538  ArrayList<IContact> list = new ArrayList<>();
539  if(!Strings.isBlank(syndication)) {
540  if("hhrr".equals(syndication)) {
541  list.addAll(getHHRR());
542  } else if("student".equals(syndication)) {
543  list.addAll(getStudents());
544  } else {
545  for(Contact c : (List<Contact>) new ContactsPU().getResultList(
546  "select s.contact from Syndication as s where s.name = ?",
547  new String[] { syndication })) {
548  list.add(c.getIContact());
549  }
550  }
551  }
552  return list;
553  }

◆ getCenters()

List<IContact> org.turro.contacts.util.DefaultContact.getCenters ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 605 of file DefaultContact.java.

605  {
606  ArrayList<IContact> list = new ArrayList<>();
607  WhereClause wc = new WhereClause();
608  wc.addClause("select contact from Contact as contact");
609  wc.addClause("where contact.type = :type");
610  wc.addNamedValue("type", ContactType.CONTACT_LEARNINGCENTER);
611  for(Contact c : (List<Contact>) new ContactsPU().getResultList(wc)) {
612  list.add(c.getIContact());
613  }
614  return list;
615  }
Here is the call graph for this function:

◆ getCommentValue()

String org.turro.contacts.util.DefaultContact.getCommentValue ( String  key)

Implements org.turro.plugin.contacts.IContact.

Definition at line 395 of file DefaultContact.java.

395  {
396  String comment = null, lang = key + Application.getUsedLocale();
397  for(Comment c : contact.getComments()) {
398  if(!Strings.isBlank(c.getComment()) && c.getComment().startsWith(lang)) {
399  comment = c.getComment().substring(lang.length());
400  break;
401  }
402  }
403  if(org.turro.string.Strings.isBlank(comment)) {
404  lang = key + "#";
405  for(Comment c : contact.getComments()) {
406  if(!Strings.isBlank(c.getComment()) && c.getComment().startsWith(lang)) {
407  comment = c.getComment().substring(lang.length());
408  break;
409  }
410  }
411  }
412  return comment;
413  }
Set< Comment > getComments()
Definition: Contact.java:415
Here is the call graph for this function:

◆ getCompanies()

List<IContact> org.turro.contacts.util.DefaultContact.getCompanies ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 592 of file DefaultContact.java.

592  {
593  ArrayList<IContact> list = new ArrayList<>();
594  WhereClause wc = new WhereClause();
595  wc.addClause("select contact from Contact as contact");
596  wc.addClause("where contact.type = :type");
597  wc.addNamedValue("type", ContactType.CONTACT_COMPANY);
598  for(Contact c : (List<Contact>) new ContactsPU().getResultList(wc)) {
599  list.add(c.getIContact());
600  }
601  return list;
602  }
Here is the call graph for this function:

◆ getCompanyRelations()

IRelations org.turro.contacts.util.DefaultContact.getCompanyRelations ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 230 of file DefaultContact.java.

230  {
231  if(_companies == null) _companies = Relations.companies(this);
232  return _companies;
233  }
Here is the call graph for this function:

◆ getConnector()

String org.turro.contacts.util.DefaultContact.getConnector ( String  id)

Implements org.turro.plugin.contacts.IContact.

Definition at line 201 of file DefaultContact.java.

201  {
202  if(contact != null) {
203  for(Connector connector : contact.getConnectors()) {
204  if(id.equalsIgnoreCase(connector.getDescription())) {
205  return connector.getValue();
206  }
207  }
208  }
209  return null;
210  }
Set< Connector > getConnectors()
Definition: Contact.java:367
Here is the call graph for this function:

◆ getConnectorList()

List<String> org.turro.contacts.util.DefaultContact.getConnectorList ( String  id)

Implements org.turro.plugin.contacts.IContact.

Definition at line 213 of file DefaultContact.java.

213  {
214  ArrayList<String> list = new ArrayList<>();
215  if(contact != null) {
216  for(Connector connector : contact.getConnectors()) {
217  if(id.equalsIgnoreCase(connector.getDescription())) {
218  list.add(connector.getValue());
219  }
220  }
221  }
222  return list;
223  }
Here is the call graph for this function:

◆ getContact()

Object org.turro.contacts.util.DefaultContact.getContact ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 122 of file DefaultContact.java.

122  {
123  return contact;
124  }

◆ getCoworkers() [1/2]

List<IContact> org.turro.contacts.util.DefaultContact.getCoworkers ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 293 of file DefaultContact.java.

293  {
294  org.turro.plugin.contacts.ContactList list = new org.turro.plugin.contacts.ContactList();
295  if(contact != null) {
296  for(Contact c : contact.getCoworkers()) {
297  if(!c.getId().equals(contact.getId())) {
298  list.add(c.getIContact());
299  }
300  }
301  }
302  return list;
303  }
List< Contact > getCoworkers()
Definition: Contact.java:636
Here is the call graph for this function:

◆ getCoworkers() [2/2]

List<IContact> org.turro.contacts.util.DefaultContact.getCoworkers ( IContact  business)

Implements org.turro.plugin.contacts.IContact.

Definition at line 306 of file DefaultContact.java.

306  {
307  org.turro.plugin.contacts.ContactList list = new org.turro.plugin.contacts.ContactList();
308  if(contact != null) {
309  for(Contact c : contact.getCoworkers((Contact) business.getContact())) {
310  if(!c.getId().equals(contact.getId())) {
311  list.add(c.getIContact());
312  }
313  }
314  }
315  return list;
316  }
Here is the call graph for this function:

◆ getDeepGrouping()

String org.turro.contacts.util.DefaultContact.getDeepGrouping ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 149 of file DefaultContact.java.

149  {
150  Contact business = contact;
151  while(business != null) {
152  if(!Strings.isBlank(business.getGrouping())) {
153  return business.getGrouping();
154  }
155  business = business.getBusiness();
156  }
157  return null;
158  }
Here is the call graph for this function:

◆ getEmail()

String org.turro.contacts.util.DefaultContact.getEmail ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 191 of file DefaultContact.java.

191  {
192  return getConnector(IUser.CONNECTOR_EMAIL);
193  }

◆ getFace()

String org.turro.contacts.util.DefaultContact.getFace ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 672 of file DefaultContact.java.

672  {
673  FileAttach fileAttach = new FileAttach(ContactsPU.getObjectPath(contact));
674  String faceFile = fileAttach.getPublicFile("/profile/face.png", false);
675  return !Strings.isBlank(faceFile) ? faceFile : null;
676  }
Here is the call graph for this function:

◆ getFaces()

Faces org.turro.contacts.util.DefaultContact.getFaces ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 679 of file DefaultContact.java.

679  {
680  return Faces.of(this);
681  }
Here is the call graph for this function:

◆ getFormal()

String org.turro.contacts.util.DefaultContact.getFormal ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 176 of file DefaultContact.java.

176  {
177  return contact != null ? contact.getFormal().trim() : "";
178  }
Here is the call graph for this function:

◆ getFriendly()

String org.turro.contacts.util.DefaultContact.getFriendly ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 171 of file DefaultContact.java.

171  {
172  return contact != null ? contact.getFriendly().trim() : "";
173  }
Here is the call graph for this function:

◆ getFullName()

String org.turro.contacts.util.DefaultContact.getFullName ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 181 of file DefaultContact.java.

181  {
182  return contact != null ? contact.getFullName().trim() : "";
183  }
Here is the call graph for this function:

◆ getGlobalId()

String org.turro.contacts.util.DefaultContact.getGlobalId ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 139 of file DefaultContact.java.

139  {
140  return contact != null ? contact.getGlobalIdentifier() : null;
141  }
Here is the call graph for this function:

◆ getGrouping()

String org.turro.contacts.util.DefaultContact.getGrouping ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 144 of file DefaultContact.java.

144  {
145  return contact != null ? contact.getGrouping() : null;
146  }
Here is the call graph for this function:

◆ getHHRR()

List<IContact> org.turro.contacts.util.DefaultContact.getHHRR ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 618 of file DefaultContact.java.

618  {
619  ArrayList<IContact> list = new ArrayList<>();
620  WhereClause wc = new WhereClause();
621  wc.addClause("select contact from Contact as contact");
622  wc.addClause("left outer join contact.businessRelations relation");
623  FuzzyRelationTypes.isHHRR(wc, "where", "relation");
624  for(Contact c : (List<Contact>) new ContactsPU().getResultList(wc)) {
625  list.add(c.getIContact());
626  }
627  return list;
628  }
Here is the call graph for this function:

◆ getId()

String org.turro.contacts.util.DefaultContact.getId ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 134 of file DefaultContact.java.

134  {
135  return contact != null ? contact.getId() : null;
136  }
Here is the call graph for this function:

◆ getLangTranslator()

String org.turro.contacts.util.DefaultContact.getLangTranslator ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 770 of file DefaultContact.java.

770  {
771  return contact.getLangTranslator();
772  }
Here is the call graph for this function:

◆ getLocale()

Locale org.turro.contacts.util.DefaultContact.getLocale ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 196 of file DefaultContact.java.

196  {
197  return contact != null ? contact.getLocale() : null;
198  }
Here is the call graph for this function:

◆ getLogged()

IContact org.turro.contacts.util.DefaultContact.getLogged ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 787 of file DefaultContact.java.

787  {
788  return Authentication.getIContact();
789  }
Here is the call graph for this function:

◆ getLogin()

String org.turro.contacts.util.DefaultContact.getLogin ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 161 of file DefaultContact.java.

161  {
162  return contact != null ? contact.getLogin() : null;
163  }
Here is the call graph for this function:

◆ getName()

String org.turro.contacts.util.DefaultContact.getName ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 166 of file DefaultContact.java.

166  {
167  return contact != null ? contact.getName().trim() : "";
168  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getObject()

Object org.turro.contacts.util.DefaultContact.getObject ( String  key)

Implements org.turro.plugin.contacts.IContact.

Definition at line 416 of file DefaultContact.java.

416  {
417  return contact.getObject(key);
418  }
Object getObject(String key)
Definition: Contact.java:658
Here is the call graph for this function:

◆ getPermissions()

FlatPermissions org.turro.contacts.util.DefaultContact.getPermissions ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 461 of file DefaultContact.java.

461  {
462  if(_permissions == null) {
463  _permissions = new ContactPermissions(this);
464  }
465  return _permissions;
466  }

◆ getProfile()

IProfile org.turro.contacts.util.DefaultContact.getProfile ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 684 of file DefaultContact.java.

684  {
685  return contact.getProfile();
686  }
Here is the call graph for this function:

◆ getProperty()

String org.turro.contacts.util.DefaultContact.getProperty ( String  key)
Parameters
keyAttribute's key.
Returns
Attribute's value.

Implements org.turro.elephant.security.IUser.

Definition at line 919 of file DefaultContact.java.

919  {
920  return getConnector(key);
921  }

◆ getRelations() [1/2]

List<IContact> org.turro.contacts.util.DefaultContact.getRelations ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 255 of file DefaultContact.java.

255  {
256  List<IContact> list = new ArrayList<>();
257  if(contact != null) {
258  for(BusinessRelation relation : contact.getBusinessSet()) {
259  list.add(relation.getBusiness().getIContact());
260  }
261  for(BusinessRelation relation : contact.getWorkerSet()) {
262  list.add(relation.getContact().getIContact());
263  }
264  }
265  return list;
266  }
Here is the call graph for this function:

◆ getRelations() [2/2]

List<IContact> org.turro.contacts.util.DefaultContact.getRelations ( String  id)

Implements org.turro.plugin.contacts.IContact.

Definition at line 242 of file DefaultContact.java.

242  {
243  List<IContact> list = new ArrayList<>();
244  if(contact != null) {
245  for(BusinessRelation relation : contact.getBusinessSet()) {
246  if(id.equalsIgnoreCase(relation.getDescription())) {
247  list.add(relation.getBusiness().getIContact());
248  }
249  }
250  }
251  return list;
252  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getStaffRelations()

IRelations org.turro.contacts.util.DefaultContact.getStaffRelations ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 236 of file DefaultContact.java.

236  {
237  if(_staff == null) _staff = Relations.staff(this);
238  return _staff;
239  }
Here is the call graph for this function:

◆ getStudents()

List<IContact> org.turro.contacts.util.DefaultContact.getStudents ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 631 of file DefaultContact.java.

631  {
632  ArrayList<IContact> list = new ArrayList<>();
633  WhereClause wc = new WhereClause();
634  wc.addClause("select contact from Contact as contact");
635  wc.addClause("left outer join contact.businessRelations relation");
636  FuzzyRelationTypes.isStudent(wc, "where", "relation");
637  for(Contact c : (List<Contact>) new ContactsPU().getResultList(wc)) {
638  list.add(c.getIContact());
639  }
640  return list;
641  }
Here is the call graph for this function:

◆ getSyndications()

List<String> org.turro.contacts.util.DefaultContact.getSyndications ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 448 of file DefaultContact.java.

448  {
449  if(_syndications == null) {
450  _syndications = new ArrayList<>();
451  for(Syndication s : contact.getSyndications()) {
452  _syndications.add(s.getName());
453  }
454  }
455  return _syndications;
456  }
Set< Syndication > getSyndications()
Definition: Contact.java:403
Here is the call graph for this function:

◆ getTradeName()

String org.turro.contacts.util.DefaultContact.getTradeName ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 186 of file DefaultContact.java.

186  {
187  return contact != null ? contact.getTradeName().trim() : "";
188  }
Here is the call graph for this function:

◆ hasAnyRoleKey()

boolean org.turro.contacts.util.DefaultContact.hasAnyRoleKey ( String  role)

Implements org.turro.elephant.security.IUser.

Definition at line 930 of file DefaultContact.java.

930  {
931  if(superUser) return true;
932  return getPermissions().anyKeyMatch(Strings.csvToList(role));
933  }
boolean anyKeyMatch(List< String > roles)

◆ hashCode()

int org.turro.contacts.util.DefaultContact.hashCode ( )

Definition at line 806 of file DefaultContact.java.

806  {
807  if (!this.isValid()) {
808  return 0;
809  }
810  int hash = 7;
811  hash = 97 * hash + Objects.hashCode(this.getId());
812  return hash;
813  }

◆ impersonate()

boolean org.turro.contacts.util.DefaultContact.impersonate ( String  login)
Parameters
loginUser login.
Returns
True if user was impersonated.

Implements org.turro.elephant.security.IUser.

Definition at line 883 of file DefaultContact.java.

883  {
884  IContact ic;
885  if(login.contains("@")) {
886  ic = loadByEmail(login);
887  if(ic != null) {
888  contact = (Contact) ic.getContact();
889  }
890  } else {
891  loadById(login);
892  }
893  if(isValid()) {
895  return true;
896  }
897  return false;
898  }
Here is the call graph for this function:

◆ impersonateByEmail()

boolean org.turro.contacts.util.DefaultContact.impersonateByEmail ( String  email)

Implements org.turro.elephant.security.IUser.

Definition at line 901 of file DefaultContact.java.

901  {
902  return impersonate(email);
903  }

◆ isActor() [1/2]

boolean org.turro.contacts.util.DefaultContact.isActor ( Object  entity,
String  actor 
)

Definition at line 780 of file DefaultContact.java.

780  {
781  return Actors.isActorFor(this, entity, actor);
782  }
Here is the call graph for this function:

◆ isActor() [2/2]

boolean org.turro.contacts.util.DefaultContact.isActor ( String  actor)

Definition at line 776 of file DefaultContact.java.

776  {
777  return Actors.isActor(this, actor);
778  }
Here is the call graph for this function:

◆ isAdmin()

boolean org.turro.contacts.util.DefaultContact.isAdmin ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 689 of file DefaultContact.java.

689  {
690  return getSyndications().contains("brightside_admin");
691  }

◆ isCenter()

boolean org.turro.contacts.util.DefaultContact.isCenter ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 704 of file DefaultContact.java.

704  {
705  return ContactType.CONTACT_LEARNINGCENTER.equals(contact.getType());
706  }
Here is the call graph for this function:

◆ isCompany()

boolean org.turro.contacts.util.DefaultContact.isCompany ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 699 of file DefaultContact.java.

699  {
700  return ContactType.CONTACT_COMPANY.equals(contact.getType());
701  }
Here is the call graph for this function:

◆ isDeactivated()

boolean org.turro.contacts.util.DefaultContact.isDeactivated ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 441 of file DefaultContact.java.

441  {
442  return contact == null ? true : contact.isDeactivated();
443  }
Here is the call graph for this function:

◆ isHHRR() [1/2]

boolean org.turro.contacts.util.DefaultContact.isHHRR ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 729 of file DefaultContact.java.

Here is the call graph for this function:

◆ isHHRR() [2/2]

boolean org.turro.contacts.util.DefaultContact.isHHRR ( IContact  business)

Implements org.turro.plugin.contacts.IContact.

Definition at line 752 of file DefaultContact.java.

752  {
753  return isUser() && ((Contact) business.getContact()).getWorkerSet()
754  .isByCondition(contact, c -> c.isHHRR(), new Date());
755  }
Here is the call graph for this function:

◆ isInBusiness()

boolean org.turro.contacts.util.DefaultContact.isInBusiness ( IContact  worker)

Implements org.turro.plugin.contacts.IContact.

Definition at line 319 of file DefaultContact.java.

319  {
320  return getCoworkers().contains(worker);
321  }

◆ isInNetworking()

boolean org.turro.contacts.util.DefaultContact.isInNetworking ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 758 of file DefaultContact.java.

Here is the call graph for this function:

◆ isInPremiumNetworking()

boolean org.turro.contacts.util.DefaultContact.isInPremiumNetworking ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 763 of file DefaultContact.java.

Here is the call graph for this function:

◆ isInRole()

boolean org.turro.contacts.util.DefaultContact.isInRole ( String  role)

Usually this method should take this form:

 if(user.isInRole("page:edit")) {
   // edit page
 }
Parameters
roleRole to check.
Returns
True if user is in role.

Implements org.turro.elephant.security.IUser.

Definition at line 924 of file DefaultContact.java.

924  {
925  if(superUser) return true;
926  return getPermissions().isInRole(role);
927  }

◆ isInternal()

boolean org.turro.contacts.util.DefaultContact.isInternal ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 709 of file DefaultContact.java.

709  {
710  return ContactType.CONTACT_INTERNAL.equals(contact.getType());
711  }
Here is the call graph for this function:

◆ isOutsider()

boolean org.turro.contacts.util.DefaultContact.isOutsider ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 792 of file DefaultContact.java.

792  {
793  return false;
794  }

◆ isResponsible() [1/2]

boolean org.turro.contacts.util.DefaultContact.isResponsible ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 724 of file DefaultContact.java.

Here is the call graph for this function:

◆ isResponsible() [2/2]

boolean org.turro.contacts.util.DefaultContact.isResponsible ( IContact  business)

Implements org.turro.plugin.contacts.IContact.

Definition at line 746 of file DefaultContact.java.

746  {
747  return isUser() && ((Contact) business.getContact()).getWorkerSet()
748  .isByCondition(contact, c -> c.isResponsible(), new Date());
749  }
Here is the call graph for this function:

◆ isStudent() [1/2]

boolean org.turro.contacts.util.DefaultContact.isStudent ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 719 of file DefaultContact.java.

Here is the call graph for this function:

◆ isStudent() [2/2]

boolean org.turro.contacts.util.DefaultContact.isStudent ( IContact  business)

Implements org.turro.plugin.contacts.IContact.

Definition at line 740 of file DefaultContact.java.

740  {
741  return isUser() && ((Contact) business.getContact()).getWorkerSet()
742  .isByCondition(contact, c -> c.isStudent(), new Date());
743  }
Here is the call graph for this function:

◆ isThisUser()

boolean org.turro.contacts.util.DefaultContact.isThisUser ( String  id)

Implements org.turro.elephant.security.IUser.

Definition at line 914 of file DefaultContact.java.

914  {
915  return !Strings.isBlank(id) && (id.equals(contact.getId()) || id.equals(contact.getLogin()));
916  }
Here is the call graph for this function:

◆ isUser()

boolean org.turro.contacts.util.DefaultContact.isUser ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 694 of file DefaultContact.java.

694  {
695  return ContactType.CONTACT_USER.equals(contact.getType());
696  }
Here is the call graph for this function:

◆ isUserMenu()

boolean org.turro.contacts.util.DefaultContact.isUserMenu ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 436 of file DefaultContact.java.

436  {
437  return contact == null ? false : contact.isUserMenu();
438  }
Here is the call graph for this function:

◆ isValid()

boolean org.turro.contacts.util.DefaultContact.isValid ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 371 of file DefaultContact.java.

371  {
372  return contact != null;
373  }
Here is the caller graph for this function:

◆ isWebapp()

boolean org.turro.contacts.util.DefaultContact.isWebapp ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 431 of file DefaultContact.java.

431  {
432  return contact == null ? false : contact.isWebapp();
433  }
Here is the call graph for this function:

◆ isWebUser()

boolean org.turro.contacts.util.DefaultContact.isWebUser ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 426 of file DefaultContact.java.

426  {
427  return contact == null ? false : (!contact.isDeactivated() && contact.isWebUser());
428  }
Here is the call graph for this function:

◆ isWorker() [1/2]

boolean org.turro.contacts.util.DefaultContact.isWorker ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 714 of file DefaultContact.java.

Here is the call graph for this function:

◆ isWorker() [2/2]

boolean org.turro.contacts.util.DefaultContact.isWorker ( IContact  business)

Implements org.turro.plugin.contacts.IContact.

Definition at line 734 of file DefaultContact.java.

734  {
735  return isUser() && ((Contact) business.getContact()).getWorkerSet()
736  .isByCondition(contact, c -> c.isWorker(), new Date());
737  }
Here is the call graph for this function:

◆ loadByEmail()

IContact org.turro.contacts.util.DefaultContact.loadByEmail ( String  email)

Implements org.turro.plugin.contacts.IContact.

Definition at line 509 of file DefaultContact.java.

509  {
510  Contact c = (Contact) new ContactsPU().getSingleResultOrNull(
511  "select c.contact from Connector as c where c.description = ? and c.value = ?",
512  new String[] { IUser.CONNECTOR_EMAIL, email });
513  return (c == null || c.isDeactivated()) ? null : c.getIContact();
514  }
Here is the call graph for this function:

◆ loadById()

Object org.turro.contacts.util.DefaultContact.loadById ( String  id)

Implements org.turro.plugin.contacts.IContact.

Definition at line 91 of file DefaultContact.java.

91  {
92  setContact(null);
93  if(!Strings.isBlank(id)) {
94  setContact(new ContactsPU().find(Contact.class, id));
95  }
96  return contact;
97  }
Here is the caller graph for this function:

◆ loadByLogin()

Object org.turro.contacts.util.DefaultContact.loadByLogin ( String  login)

Checks both, login and id, since login has been replaced in wiki generated files.

Implements org.turro.plugin.contacts.IContact.

Definition at line 103 of file DefaultContact.java.

103  {
104  setContact((Contact) new ContactsPU().getSingleResultOrNull(
105  "select c from Contact as c where c.login = ? or c.id = ?",
106  new String[] { login, login }));
107  return contact;
108  }

◆ loadByName()

IContact org.turro.contacts.util.DefaultContact.loadByName ( String  name)

Implements org.turro.plugin.contacts.IContact.

Definition at line 501 of file DefaultContact.java.

501  {
502  Contact c = (Contact) new ContactsPU().getSingleResultOrNull(
503  "select c from Contact as c where c.name = ?",
504  new String[] { name });
505  return c == null ? null : c.getIContact();
506  }
Here is the call graph for this function:

◆ loadByPartialName() [1/2]

List<IContact> org.turro.contacts.util.DefaultContact.loadByPartialName ( String  name)

Implements org.turro.plugin.contacts.IContact.

Definition at line 484 of file DefaultContact.java.

484  {
485  return loadByPartialName(name, null);
486  }
List< IContact > loadByPartialName(String name)

◆ loadByPartialName() [2/2]

List<IContact> org.turro.contacts.util.DefaultContact.loadByPartialName ( String  name,
KeyValueMap  kvm 
)

Implements org.turro.plugin.contacts.IContact.

Definition at line 489 of file DefaultContact.java.

489  {
490  ArrayList<IContact> list = new ArrayList<IContact>();
491  if(name != null && name.trim().length() > 2) {
492  ContactEntities ce = new ContactEntities();
493  for(Contact c : ((Collection<Contact>) ce.getEntitites("contact", name, 0, kvm))) {
494  list.add(c.getIContact());
495  }
496  }
497  return list;
498  }
Here is the call graph for this function:

◆ loadLogged()

Object org.turro.contacts.util.DefaultContact.loadLogged ( Application  app)

Implements org.turro.plugin.contacts.IContact.

Definition at line 111 of file DefaultContact.java.

111  {
112  IUser user = app.getConstructor().getUser();
113  if(user instanceof IContact) {
114  setContact((Contact) ((IContact) user).getContact());
115  return user;
116  } else {
117  return user != null ? loadByLogin(app.getConstructor().getUser().getId()) : null;
118  }
119  }
Here is the call graph for this function:

◆ reload()

void org.turro.contacts.util.DefaultContact.reload ( )

Implements org.turro.elephant.security.IUser.

Definition at line 906 of file DefaultContact.java.

906  {
907  loadById(getId());
908  if(isValid()) {
910  }
911  }

◆ resetPermissions()

void org.turro.contacts.util.DefaultContact.resetPermissions ( )

Implements org.turro.plugin.contacts.IContact.

Definition at line 469 of file DefaultContact.java.

469  {
470  _permissions = null;
471  }

◆ setAttribute()

void org.turro.contacts.util.DefaultContact.setAttribute ( String  key,
Object  value 
)

Implements org.turro.plugin.contacts.IContact.

Definition at line 527 of file DefaultContact.java.

527  {
528  contact.setAttribute(key, value);
529  }
void setAttribute(String key, Object value)
Definition: Contact.java:549
Here is the call graph for this function:

◆ setConnector()

void org.turro.contacts.util.DefaultContact.setConnector ( String  id,
String  value 
)

Implements org.turro.plugin.contacts.IContact.

Definition at line 324 of file DefaultContact.java.

324  {
325  if(contact != null) {
326  for(Connector connector : contact.getConnectors()) {
327  if(id.equalsIgnoreCase(connector.getDescription())) {
328  connector.setValue(value);
329  return;
330  }
331  }
332  Connector connector = new Connector();
333  connector.setOwner(contact.getOwner());
334  connector.setOnlyOwner(false);
335  connector.setContact(contact);
336  connector.setDescription(id);
337  connector.setValue(value);
338  contact.getConnectors().add(connector);
339  }
340  }
Here is the call graph for this function:

◆ setContact()

void org.turro.contacts.util.DefaultContact.setContact ( Object  contact)

Implements org.turro.plugin.contacts.IContact.

Definition at line 127 of file DefaultContact.java.

127  {
128  this.contact = (Contact) contact;
129  //_roles = null;
130  _syndications = null;
131  }

◆ setName()

void org.turro.contacts.util.DefaultContact.setName ( String  value)

Implements org.turro.plugin.contacts.IContact.

Definition at line 343 of file DefaultContact.java.

343  {
344  if(contact != null) {
345  contact.setName(value);
346  contact.getComplexName().setFull(value);
347  }
348  }
void setName(String name)
Definition: Contact.java:217
ComplexName getComplexName()
Definition: Contact.java:152
Here is the call graph for this function:

◆ setObject()

void org.turro.contacts.util.DefaultContact.setObject ( String  key,
Serializable  value 
)

Implements org.turro.plugin.contacts.IContact.

Definition at line 421 of file DefaultContact.java.

421  {
422  contact.setObject(key, value);
423  }
void setObject(String key, Serializable value)
Definition: Contact.java:664
Here is the call graph for this function:

◆ setPassword()

void org.turro.contacts.util.DefaultContact.setPassword ( String  newValue,
String  repeatValue 
)

Implements org.turro.plugin.contacts.IContact.

Definition at line 351 of file DefaultContact.java.

351  {
352  if(newValue != null && newValue.trim().length() > 0 && newValue.equals(repeatValue)) {
353  try {
354  contact.setPass1(ElephantContext.encrypt(newValue));
355  } catch (Exception ex) {
356  Logger.getLogger(DefaultContact.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
357  }
358  }
359  }
void setPass1(String pass1)
Definition: Contact.java:255
Here is the call graph for this function:

◆ startContactFromValues()

void org.turro.contacts.util.DefaultContact.startContactFromValues ( KeyValueMap  values)

Implements org.turro.plugin.contacts.IContact.

Definition at line 644 of file DefaultContact.java.

644  {
645  Contact newContact = new Contact();
646  if(values.containsKey("name")) {
647  newContact.setName(values.get(String.class, "name"));
648  }
649  if(values.containsKey("email")) {
650  Connector connector = new Connector();
651  connector.setContact(newContact);
652  connector.setDescription(IUser.CONNECTOR_EMAIL);
653  connector.setValue(values.get(String.class, "email"));
654  newContact.getConnectors().add(connector);
655  }
656  ContactMenu.showContact(newContact);
657  }

◆ syndicate()

void org.turro.contacts.util.DefaultContact.syndicate ( String  syndicationName,
boolean  syndicate 
)

Implements org.turro.plugin.contacts.IContact.

Definition at line 660 of file DefaultContact.java.

660  {
661  Dao dao = new ContactsPU();
662  if(syndicate) {
663  SocialGroups.syndicate(List.of(contact), Set.of(syndicationName), null);
664  } else {
665  SocialGroups.unsyndicate(List.of(contact), Set.of(syndicationName), null);
666  }
667  setContact(dao.saveObject(contact));
668  SocialGroups.checkInheritance(List.of(contact), dao);
669  }
void syndicate(String syndicationName, boolean syndicate)
Here is the call graph for this function:

◆ validate()

boolean org.turro.contacts.util.DefaultContact.validate ( String  login,
String  password 
)
Parameters
loginUser login.
passwordUser password.
Returns
True if user was validated.

Implements org.turro.elephant.security.IUser.

Definition at line 849 of file DefaultContact.java.

849  {
850  login = login.trim();
851  password = password.trim();
852  if(Strings.isBlank(login) || Strings.isBlank(password)) return false;
853  Map<String, Object> args = new HashMap<>();
854  args.put("login", login);
855  args.put("password", password);
856  args = Plugins.execute("SuperUser", args);
857  if(Boolean.TRUE.equals(args.get("su"))) {
858  superUser = true;
859  return true;
860  }
861  IContact ic;
862  if(login.contains("@")) {
863  ic = loadByEmail(login);
864  if(ic != null) {
865  contact = (Contact) ic.getContact();
866  }
867  }
868  if(isValid() && checkPassword(password)) {
870  return true;
871  } else {
872  contact = null;
873  }
874  return false;
875  }
boolean checkPassword(String password)
Here is the call graph for this function:

◆ validate2()

boolean org.turro.contacts.util.DefaultContact.validate2 ( String  password2)
Parameters
password2User password2.
Returns
True if user validates password2.

Implements org.turro.elephant.security.IUser.

Definition at line 878 of file DefaultContact.java.

878  {
879  return checkPassword2(password2);
880  }
boolean checkPassword2(String password)

Member Data Documentation

◆ contact

Contact org.turro.contacts.util.DefaultContact.contact = null
protected

Definition at line 77 of file DefaultContact.java.

◆ superUser

boolean org.turro.contacts.util.DefaultContact.superUser = false
protected

Definition at line 846 of file DefaultContact.java.


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