BrightSide Workbench Full Report + Source Code
org.turro.contacts.util.ContactToUser Class Reference

Public Member Functions

 ContactToUser ()
 
 ContactToUser (IConstructor constructor, Contact contact)
 
void setConstructor (IConstructor constructor)
 
void setContact (Contact contact)
 
boolean isLoginValid (String value)
 
void doUserChanges () throws Exception
 
void doUserDeletions ()
 

Detailed Description

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

Definition at line 37 of file ContactToUser.java.

Constructor & Destructor Documentation

◆ ContactToUser() [1/2]

org.turro.contacts.util.ContactToUser.ContactToUser ( )

Definition at line 42 of file ContactToUser.java.

42  {
43  }

◆ ContactToUser() [2/2]

org.turro.contacts.util.ContactToUser.ContactToUser ( IConstructor  constructor,
Contact  contact 
)

Definition at line 45 of file ContactToUser.java.

45  {
46  setConstructor(constructor);
47  setContact(contact);
48  }
void setConstructor(IConstructor constructor)
Here is the call graph for this function:

Member Function Documentation

◆ doUserChanges()

void org.turro.contacts.util.ContactToUser.doUserChanges ( ) throws Exception

Definition at line 72 of file ContactToUser.java.

72  {
73  String login = contact.getLogin();
74  if (login != null && login.length() > 0) {
75  IUserAdmin uAdmin = ContextFactory.getUserAdmin(constructor);
76  try {
77  if (uAdmin.checkId(login)) {
78  uAdmin.setName(login, contact.getName());
79  uAdmin.setPasswords(login, ElephantContext.decrypt(contact.getPass1()),
80  ElephantContext.decrypt(contact.getPass2()));
81  } else {
82  uAdmin.addUser(login, contact.getName(), ElephantContext.decrypt(contact.getPass1()),
83  ElephantContext.decrypt(contact.getPass2()));
84  }
85  uAdmin.removeProperty(login, IUser.CONNECTOR_EMAIL);
86  for (Connector c : contact.getConnectors()) {
87  if (c.getDescription().toLowerCase().equals(IUser.CONNECTOR_EMAIL.toLowerCase())) {
88  uAdmin.setProperty(login, IUser.CONNECTOR_EMAIL, c.getValue());
89  }
90  }
91  for (Connector c : contact.getConnectors()) {
92  if (c.getDescription().toLowerCase().equals(IUser.CONNECTOR_EMAIL_LOGIN.toLowerCase())) {
93  uAdmin.setProperty(login, IUser.CONNECTOR_EMAIL_LOGIN, c.getValue());
94  }
95  }
96  uAdmin.cleanRoles(login);
97  for (Role r : contact.getRoles()) {
98  uAdmin.setRole(login, r.getName());
99  }
100  } catch (IOException ex) {
101  Logger.getLogger(ContactToUser.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
102  }
103  }
104  }
Set< Role > getRoles()
Definition: Contact.java:406
Set< Connector > getConnectors()
Definition: Contact.java:358
Here is the call graph for this function:

◆ doUserDeletions()

void org.turro.contacts.util.ContactToUser.doUserDeletions ( )

Definition at line 106 of file ContactToUser.java.

106  {
107  String login = contact.getLogin();
108  if (login != null && login.length() > 0) {
109  IUserAdmin uAdmin = ContextFactory.getUserAdmin(constructor);
110  if (uAdmin.checkId(login)) {
111  try {
112  uAdmin.removeUser(login);
113  } catch (IOException ex) {
114  Logger.getLogger(ContactToUser.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
115  }
116  }
117  }
118  }
Here is the call graph for this function:

◆ isLoginValid()

boolean org.turro.contacts.util.ContactToUser.isLoginValid ( String  value)

Definition at line 58 of file ContactToUser.java.

58  {
59  String login = contact.getLogin();
60  if (login == null || login.length() == 0) {
61  login = (String) value;
62  if (login.length() > 0) {
63  IUserAdmin uAdmin = ContextFactory.getUserAdmin(constructor);
64  if (uAdmin.checkId(login)) {
65  return false;
66  }
67  }
68  }
69  return true;
70  }
Here is the call graph for this function:

◆ setConstructor()

void org.turro.contacts.util.ContactToUser.setConstructor ( IConstructor  constructor)

Definition at line 50 of file ContactToUser.java.

50  {
51  this.constructor = constructor;
52  }
Here is the caller graph for this function:

◆ setContact()

void org.turro.contacts.util.ContactToUser.setContact ( Contact  contact)

Definition at line 54 of file ContactToUser.java.

54  {
55  this.contact = contact;
56  }
Here is the caller graph for this function:

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