import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Event;
import javax.enterprise.inject.Any;
+import javax.faces.context.FacesContext;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
public void init () {
}
+ @Override
+ public boolean isGenderRequired () {
+ // Get context parameter
+ String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_admin_gender_enabled"); //NOI18N
+
+ // Is it set?
+ boolean isRequired = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N
+
+ // Return value
+ return isRequired;
+ }
+
/**
* Clears this bean
*/
*/
String generateCellphoneNumber (final DialableCellphoneNumber cellphoneNumber);
+ /**
+ * Checks/returns whether the gender/salutation is required for this
+ * controller.
+ * <p>
+ * @return Whether gender is required
+ */
+ boolean isGenderRequired ();
+
}
@Override
public void afterAdminAddedContact (@Observes final AdminAddedContactEvent event) {
+ // Trace message
+ /* NOISY-DEBUG: */ System.out.println(MessageFormat.format("contactController.afterAdminAddedContact(): event={0} - CALLED!", event)); //NOI18N
+
// The event must be valid
if (null == event) {
// Throw NPE
import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
import org.mxchange.jusercore.events.user.add.AdminUserAddedEvent;
+import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
import org.mxchange.jusercore.events.user.linked.AdminUserLinkedEvent;
import org.mxchange.jusercore.events.user.update.AdminUpdatedUserDataEvent;
import org.mxchange.jusercore.events.user.update.AdminUserDataUpdatedEvent;
@Inject
private JobsUserWebSessionController userController;
+ /**
+ * An event fired when the administrator has linked a user with existing
+ * contact data.
+ */
+ @Inject
+ @Any
+ private Event<AdminLinkedUserEvent> userLinkedEvent;
+
/**
* User lock reason
*/
// Clear helper
this.beanHelper.setContact(null);
+ // Clear this bean
+ this.clear();
+
// Return to user list (for now)
return "admin_list_user"; //NOI18N
}
// Debug message
//* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterRegistration: registeredUser={0}", registeredUser)); //NOI18N
-
// Clear all data
this.clear();
// Initialize user list
this.visibleUserList = this.userBean.allPublicUsers();
}
-
- // Get all users
- List<User> allUsers = this.allUsers();
-
- // Get all contacts
- List<Contact> allContacts = this.contactBean.getAllContacts();
-
- // Get iterator
- Iterator<Contact> iterator = allContacts.iterator();
-
- // Loop through it
- while (iterator.hasNext()) {
- // Get next element
- Contact next = iterator.next();
-
- // Get iterator
- Iterator<User> userIterator = allUsers.iterator();
-
- // Loop through all users
- while (userIterator.hasNext()) {
- // Get user instance
- User nextUser = userIterator.next();
-
- // Is contact same?
- if (Objects.equals(next, nextUser.getUserContact())) {
- // Found same
- iterator.remove();
- break;
- }
- }
- }
}
@Override
<div class="table_right_medium">
<h:selectOneMenu styleClass="select" id="userContact" value="#{beanHelper.contact}" converter="ContactConverter">
<f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
- <f:selectItems value="#{userController.selectableContacts()}" var="contact" itemValue="#{contact}" itemLabel="#{contact.contactId}: #{msg[contact.contactGender.messageKey]} #{contact.contactFirstName} #{contact.contactFamilyName}" />
+ <f:selectItems value="#{contactController.selectableContacts()}" var="contact" itemValue="#{contact}" itemLabel="#{contact.contactId}: #{msg[contact.contactGender.messageKey]} #{contact.contactFirstName} #{contact.contactFamilyName}" />
</h:selectOneMenu>
</div>