BrightSide Workbench Full Report + Source Code
org.turro.action.Contacts Class Reference

Static Public Member Functions

static boolean exists (String idContact)
 
static boolean isValid (IContact contact)
 
static IContact getEmpty ()
 
static IContact getEmptyFor (Object object)
 
static IContact getContactById (String id)
 
static IContact getContactByEmail (String email)
 
static List< IContactgetWebUsers (List< IContact > contacts)
 
static boolean hasValidEmail (IContact contact)
 
static boolean isValidEmail (String email)
 
static String getNoEmail ()
 
static IContact getContact (Object object)
 
static IContact getLoggedIContact (Application app)
 
static List< IContactgetBySyndication (String syndication)
 
static List< IContactgetByRole (String role)
 
static List< IContactgetByGrouping (String grouping)
 
static List< IContactgetByGrouping (List< String > groupings)
 
static List< IContactgetCenters ()
 
static List< IContactgetStudents ()
 
static IContact getBehavingAs ()
 
static void startContactFromValues (KeyValueMap values)
 
static boolean isCompany (IContact contact)
 
static boolean isCenter (IContact contact)
 
static boolean isWorker (IContact contact)
 
static boolean isHHRR (IContact contact)
 
static boolean isStudent (IContact contact)
 
static SortedMap< Integer, Class > instance ()
 
static void reset ()
 

Static Public Attributes

static final String LOGGED_ICONTACT = "loggedIContact"
 

Detailed Description

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

Definition at line 42 of file Contacts.java.

Member Function Documentation

◆ exists()

static boolean org.turro.action.Contacts.exists ( String  idContact)
static

Definition at line 48 of file Contacts.java.

48  {
49  return getContactById(idContact).isValid();
50  }
static IContact getContactById(String id)
Definition: Contacts.java:72
Here is the call graph for this function:

◆ getBehavingAs()

static IContact org.turro.action.Contacts.getBehavingAs ( )
static

Definition at line 154 of file Contacts.java.

154  {
155  Application app = Application.getApplication();
156  IContact contact = (IContact) app.getHttpSession(false).getAttribute(BEHAVEAS_ICONTACT);
157  if(contact == null) {
158  contact = (IContact) app.getHttpSession(false).getAttribute(LOGGED_ICONTACT);
159  }
160  return contact;
161  }
static final String LOGGED_ICONTACT
Definition: Contacts.java:45
Here is the call graph for this function:

◆ getByGrouping() [1/2]

static List<IContact> org.turro.action.Contacts.getByGrouping ( List< String >  groupings)
static

Definition at line 142 of file Contacts.java.

142  {
143  return getEmpty().getByGrouping(groupings);
144  }
static IContact getEmpty()
Definition: Contacts.java:56
List< IContact > getByGrouping(String grouping)
Here is the call graph for this function:

◆ getByGrouping() [2/2]

static List<IContact> org.turro.action.Contacts.getByGrouping ( String  grouping)
static

Definition at line 138 of file Contacts.java.

138  {
139  return getEmpty().getByGrouping(grouping);
140  }
Here is the call graph for this function:

◆ getByRole()

static List<IContact> org.turro.action.Contacts.getByRole ( String  role)
static

Definition at line 134 of file Contacts.java.

134  {
135  return getEmpty().getByRole(role);
136  }
List< IContact > getByRole(String role)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBySyndication()

static List<IContact> org.turro.action.Contacts.getBySyndication ( String  syndication)
static

Definition at line 130 of file Contacts.java.

130  {
131  return getEmpty().getBySyndication(syndication);
132  }
List< IContact > getBySyndication(String syndication)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCenters()

static List<IContact> org.turro.action.Contacts.getCenters ( )
static

Definition at line 146 of file Contacts.java.

146  {
147  return getEmpty().getCenters();
148  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getContact()

static IContact org.turro.action.Contacts.getContact ( Object  object)
static

Definition at line 109 of file Contacts.java.

109  {
110  if(object instanceof String) {
111  return getContactById((String) object);
112  } else {
113  IContact contact = getEmptyFor(object);
114  if(contact != null) {
115  contact.setContact(object);
116  return contact;
117  }
118  }
119  return null;
120  }
static IContact getEmptyFor(Object object)
Definition: Contacts.java:64
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getContactByEmail()

static IContact org.turro.action.Contacts.getContactByEmail ( String  email)
static

Definition at line 83 of file Contacts.java.

83  {
84  IContact iContact = getEmpty();
85  if(iContact != null) {
86  iContact = iContact.loadByEmail(email);
87  }
88  return iContact;
89  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getContactById()

static IContact org.turro.action.Contacts.getContactById ( String  id)
static

Definition at line 72 of file Contacts.java.

72  {
73  if(!Strings.isBlank(id) && id.startsWith("/contact/")) {
74  id = new Path(id).getNode(1);
75  }
76  IContact iContact = getEmptyFor(id);
77  if(iContact != null && !Strings.isBlank(id)) {
78  iContact.loadById(id);
79  }
80  return iContact;
81  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEmpty()

static IContact org.turro.action.Contacts.getEmpty ( )
static

Definition at line 56 of file Contacts.java.

56  {
57  for(Class javaClass : instance().values()) {
58  IContact contact = (IContact) Reflections.of(javaClass).instance();
59  if(contact != null) return contact;
60  }
61  return null;
62  }
static SortedMap< Integer, Class > instance()
Definition: Contacts.java:194
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEmptyFor()

static IContact org.turro.action.Contacts.getEmptyFor ( Object  object)
static

Definition at line 64 of file Contacts.java.

64  {
65  for(Class javaClass : instance().values()) {
66  IContact contact = (IContact) Reflections.of(javaClass).instance();
67  if(contact != null && contact.accepts(object)) return contact;
68  }
69  return getEmpty();
70  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLoggedIContact()

static IContact org.turro.action.Contacts.getLoggedIContact ( Application  app)
static

Definition at line 122 of file Contacts.java.

122  {
123  IContact contact = getEmptyFor(app.getConstructor().getUser());
124  if(contact != null) {
125  contact.loadLogged(app);
126  }
127  return contact;
128  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNoEmail()

static String org.turro.action.Contacts.getNoEmail ( )
static

Definition at line 104 of file Contacts.java.

104  {
105  return "nomail@nomail.no";
106  }
Here is the caller graph for this function:

◆ getStudents()

static List<IContact> org.turro.action.Contacts.getStudents ( )
static

Definition at line 150 of file Contacts.java.

150  {
151  return getEmpty().getStudents();
152  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getWebUsers()

static List<IContact> org.turro.action.Contacts.getWebUsers ( List< IContact contacts)
static

Definition at line 91 of file Contacts.java.

91  {
92  return contacts.stream().filter((contact) -> (contact.isWebUser())).collect(Collectors.toList());
93  }

◆ hasValidEmail()

static boolean org.turro.action.Contacts.hasValidEmail ( IContact  contact)
static

Definition at line 95 of file Contacts.java.

95  {
96  return isValidEmail(contact.getConnector(IUser.CONNECTOR_EMAIL));
97  }
static boolean isValidEmail(String email)
Definition: Contacts.java:99
Here is the call graph for this function:

◆ instance()

static SortedMap<Integer, Class> org.turro.action.Contacts.instance ( )
static

Definition at line 194 of file Contacts.java.

194  {
195  return INIT.instance(() -> getContactClasses());
196  }
Here is the caller graph for this function:

◆ isCenter()

static boolean org.turro.action.Contacts.isCenter ( IContact  contact)
static

Definition at line 174 of file Contacts.java.

174  {
175  return Optional.ofNullable(contact).filter(c -> c.isValid() && c.isCenter()).isPresent();
176  }

◆ isCompany()

static boolean org.turro.action.Contacts.isCompany ( IContact  contact)
static

Definition at line 170 of file Contacts.java.

170  {
171  return Optional.ofNullable(contact).filter(c -> c.isValid() && c.isCompany()).isPresent();
172  }

◆ isHHRR()

static boolean org.turro.action.Contacts.isHHRR ( IContact  contact)
static

Definition at line 182 of file Contacts.java.

182  {
183  return Optional.ofNullable(contact).filter(c -> c.isValid() && c.isHHRR()).isPresent();
184  }

◆ isStudent()

static boolean org.turro.action.Contacts.isStudent ( IContact  contact)
static

Definition at line 186 of file Contacts.java.

186  {
187  return Optional.ofNullable(contact).filter(c -> c.isValid() && c.isStudent()).isPresent();
188  }
Here is the caller graph for this function:

◆ isValid()

static boolean org.turro.action.Contacts.isValid ( IContact  contact)
static

Definition at line 52 of file Contacts.java.

52  {
53  return contact != null && contact.isValid();
54  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isValidEmail()

static boolean org.turro.action.Contacts.isValidEmail ( String  email)
static

Definition at line 99 of file Contacts.java.

99  {
100  if(Strings.isBlank(email) || email.contains("nomail")) return false;
101  return MailValidator.single().silently(email);
102  }
Here is the caller graph for this function:

◆ isWorker()

static boolean org.turro.action.Contacts.isWorker ( IContact  contact)
static

Definition at line 178 of file Contacts.java.

178  {
179  return Optional.ofNullable(contact).filter(c -> c.isValid() && c.isWorker()).isPresent();
180  }

◆ reset()

static void org.turro.action.Contacts.reset ( )
static

Definition at line 198 of file Contacts.java.

198  {
199  INIT.reset();
200  }

◆ startContactFromValues()

static void org.turro.action.Contacts.startContactFromValues ( KeyValueMap  values)
static

Definition at line 163 of file Contacts.java.

163  {
164  IContact iContact = getEmpty();
165  if(iContact != null) {
166  iContact.startContactFromValues(values);
167  }
168  }
Here is the caller graph for this function:

Member Data Documentation

◆ LOGGED_ICONTACT

final String org.turro.action.Contacts.LOGGED_ICONTACT = "loggedIContact"
static

Definition at line 45 of file Contacts.java.


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