- administrative controller are request-scoped, therefor their "cached" lists are never cached for a longer time. So all lists has to be moved to general controllers
- added new general customer bean for above refacturing
Signed-off-by: Roland Häder <roland@haeder.net>
Signed-off-by: Roland Häder <roland@mxchange.org>
*/
void copyUserToController ();
+ /**
+ * Returns a message key depending on if this contact is a user and/or a
+ * contact. If this contact is unused, a default key is returned.
+ * <p>
+ * @param contact Contact instance to check
+ * <p>
+ * @return Message key
+ */
+ String getContactUsageMessageKey (final Contact contact);
+
/**
* Getter for contact instance
* <p>
private static final long serialVersionUID = 17_258_793_567_145_701L;
/**
- * Admin contact controller
+ * Administrative contact controller
*/
@Inject
private JobsAdminContactWebRequestController adminContactController;
/**
- * Admin user controller
+ * Administrative user controller
*/
@Inject
private JobsAdminUserWebRequestController adminUserController;
@Override
public void copyContactToController () {
// Log message
- System.out.println("AdminHelper::copyContactToController - CALLED!"); //NOI18N
+ //* NOISY-DEBUG: */ System.out.println("AdminHelper::copyContactToController - CALLED!"); //NOI18N
// Validate user instance
if (this.getContact() == null) {
this.adminContactController.copyContactToController(this.getContact());
// Log message
- System.out.println("AdminHelper::copyContactToController - EXIT!"); //NOI18N
+ //* NOISY-DEBUG: */ System.out.println("AdminHelper::copyContactToController - EXIT!"); //NOI18N
}
@Override
public void copyUserToController () {
+ // Log message
+ //* NOISY-DEBUG: */ System.out.println("AdminHelper::copyUserToController - CALLED!"); //NOI18N
+
// Validate user instance
if (this.getUser() == null) {
// Throw NPE
this.adminUserController.setUserName(this.getUser().getUserName());
// Log message
- System.out.println("AdminHelper::copyUserToController - EXIT!"); //NOI18N
+ //* NOISY-DEBUG: */ System.out.println("AdminHelper::copyUserToController - EXIT!"); //NOI18N
}
@Override
this.contact = contact;
}
+ @Override
+ public User getUser () {
+ return this.user;
+ }
+
+ @Override
+ public void setUser (final User user) {
+ this.user = user;
+ }
+
@Override
public String getContactUsageMessageKey (final Contact contact) {
// The contact must be valid
return messageKey;
}
- @Override
- public User getUser () {
- return this.user;
- }
-
- @Override
- public void setUser (final User user) {
- this.user = user;
- }
-
}
@Override
public String addUser () {
- // Create new user instance
- User user = new LoginUser();
-
// As the form cannot validate the data (required="true"), check it here
if (this.getUserName() == null) {
// Throw NPE
} else if (this.contactController.getFamilyName().isEmpty()) {
// ... and again
throw new IllegalArgumentException("contactController.familyName is empty"); //NOI18N //NOI18N
- } else if (this.contactController.getEmailAddress()== null) {
+ } else if (this.contactController.getEmailAddress() == null) {
// ... and again
throw new NullPointerException("contactController.emailAddress is null");
} else if (this.contactController.getEmailAddress().isEmpty()) {
// ... and again
throw new IllegalArgumentException("contactController.emailAddress is empty"); //NOI18N //NOI18N
- } else if (this.contactController.getEmailAddressRepeat()== null) {
+ } else if (this.contactController.getEmailAddressRepeat() == null) {
// ... and again
throw new NullPointerException("contactController.emailAddressRepeat is null");
} else if (this.contactController.getEmailAddressRepeat().isEmpty()) {
}
}
+ // Create new user instance
+ User user = new LoginUser();
+
// Set user name, CONFIRMED and INVISIBLE
user.setUserName(this.getUserName());
user.setUserAccountStatus(UserAccountStatus.CONFIRMED);
// Add new contact
updatedUser = this.userBean.addUser(user);
}
- } catch (final UserNameAlreadyRegisteredException | EmailAddressAlreadyRegisteredException ex) {
+ } catch (final UserNameAlreadyRegisteredException | EmailAddressAlreadyRegisteredException ex) {
// Throw again
throw new FaceletException(ex);
}
throw new NullPointerException("adminHelper.user.userId is null"); //NOI18N //NOI18N
} else if (user.getUserId() < 1) {
// Invalid id
- throw new IllegalStateException(MessageFormat.format("adminHelper.user.userId={0} is invalid", user.getUserId()));
+ throw new IllegalStateException(MessageFormat.format("adminHelper.user.userId={0} is invalid", user.getUserId())); //NOI18N
} else if (this.getUserName() == null) {
// Not all required fields are set
throw new NullPointerException("this.userName is null"); //NOI18N
}
@Override
- public void afterRegistrationEvent (final @Observes UserRegisteredEvent event) {
+ public void afterRegistrationEvent (@Observes final UserRegisteredEvent event) {
// Trace message
//* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterRegistration: event={0} - CALLED!", event)); //NOI18N
this.contactController.updateContactDataFromController(user.getUserContact());
// It should be there, so run some tests on it
- assert (user instanceof User) : "Instance loginController.loggedInUser is null";
- assert (user.getUserId() instanceof Long) : "Instance loginController.loggedInUser.userId is null";
- assert (user.getUserId() > 0) : MessageFormat.format("loginController.loggedInUser.userId={0} is invalid", user.getUserId());
- assert (user.getUserContact() instanceof Contact) : "Instance loginController.loggedInUser.userContact is null";
- assert (user.getUserContact().getContactId() instanceof Long) : "Instance loginController.userContact.contactId is null";
- assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance loginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId());
+ assert (user instanceof User) : "Instance loginController.loggedInUser is null"; //NOI18N
+ assert (user.getUserId() instanceof Long) : "Instance loginController.loggedInUser.userId is null"; //NOI18N
+ assert (user.getUserId() > 0) : MessageFormat.format("loginController.loggedInUser.userId={0} is invalid", user.getUserId()); //NOI18N
+ assert (user.getUserContact() instanceof Contact) : "Instance loginController.loggedInUser.userContact is null"; //NOI18N
+ assert (user.getUserContact().getContactId() instanceof Long) : "Instance loginController.userContact.contactId is null"; //NOI18N
+ assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance loginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId()); //NOI18N
// Update all fields
user.setUserProfileMode(this.getUserProfileMode());
DialableFaxNumber fax = user.getUserContact().getContactFaxNumber();
DialableLandLineNumber phone = user.getUserContact().getContactLandLineNumber();
}
+
}
BUTTON_ADMIN_DELETE_CONTACT=Kontaktdaten l\u00f6schen
ADMIN_DELETE_CONTACT_NOTICE=Sie wollen Kontaktdaten l\u00f6schen. Diese k\u00f6nnten noch evtl. mit anderen Daten verkn\u00fcft sein, was zu Fehlern f\u00fchrt. Bitte l\u00f6schen Sie nur, wenn Sie sich absolut sicher sind, dass keine fremden Daten auf diesen Datensatz mehr verweisen.
ADMIN_CONTACT_PERSONAL_DATA_MINIMUM_NOTICE=Bitte geben Sie mindestens Anrede, Vor- und Nachnamen ein.
-ERROR_CUSTOMER_ID_NOT_FOUND=Fehler: Kundeneintrag nicht gefunden.
+ADMIN_MENU_CONTACT_TITLE=Manage contact data
+LINK_ADMIN_LIST_CONTACT=Kontaktdaten auflisten
+LINK_ADMIN_LIST_CONTACT_TITLE=Listet alle Kontaktdaten auf, egal wo her sie angelegt wurden.
+CONTACT_IS_USER=Ist Benutzer
ERROR_PARAMETER_CONTACT_NOT_SET=Error: Parameter 'contact' is not set.
ADMIN_HEADER_SHOW_CONTACT=Contact data for {0}:
ADMIN_CONTACT_UPDATED=Contact data updated:
-ADMIN_LINK_DELETE_CONTACT=Kontakt l\u00f6schen
+ADMIN_LINK_DELETE_CONTACT=Delete contact data
ADMIN_LINK_DELETE_CONTACT_TITLE=Deletes contact data, a confirmation is needed.
PAGE_TITLE_ADMIN_DELETE_CONTACT=Delete contact data
CONTENT_TITLE_ADMIN_DELETE_CONTACT=Delete contact data:
BUTTON_ADMIN_DELETE_CONTACT=Delete contact data
ADMIN_DELETE_CONTACT_NOTICE=You want to delete contact data. This data could be still linked with other data which could lead to errors. Please delete only, if you are sure that no foreign data links to this record.
ADMIN_CONTACT_PERSONAL_DATA_MINIMUM_NOTICE=Please enter at least gender, first name and family name.
-ERROR_CUSTOMER_ID_NOT_FOUND=Error: Customer entry not found.
+ADMIN_MENU_CONTACT_TITLE=Manage contact data
+LINK_ADMIN_LIST_CONTACT=List contact data
+LINK_ADMIN_LIST_CONTACT_TITLE=Lists all contact data regardless where they was created.
+CONTACT_IS_USER=Is a user
<h:column>
<f:facet name="header">#{msg.ADMIN_CONTACT_USAGE}</f:facet>
- <h:outputText value="#{msg[adminHelper.getUserCustomerUsageMessageKey(contact)]}" />
+ <h:outputText value="#{msg[adminHelper.getContactUsageMessageKey(contact)]}" />
</h:column>
<h:column>
</ui:define>
<ui:define name="content">
- <h:dataTable id="table_list_users" var="user" value="#{adminUserController.allUsers()}" styleClass="table_big" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_USERS}" rendered="#{adminUserController.hasUsers()}">
+ <h:dataTable id="table_list_users" var="user" value="#{userController.allUsers()}" styleClass="table_big" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_USERS}" rendered="#{userController.hasUsers()}">
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST_USER_ID}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_USER_ID}</f:facet>
<h:link outcome="admin_show_user" title="#{msg.ADMIN_LINK_SHOW_USER_TITLE}" value="#{user.userId}">
<f:param name="userId" value="#{user.userId}" />
</h:column>
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST_USER_NAME}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_USER_NAME}</f:facet>
<h:outputText value="#{user.userName}" />
</h:column>
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST_USER_GENDER}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_CONTACT_GENDER}</f:facet>
<h:outputText value="#{msg[user.userContact.contactGender.messageKey]}" />
</h:column>
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST_USER_FIRST_NAME}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_CONTACT_FIRST_NAME}</f:facet>
<h:outputText value="#{user.userContact.contactFirstName}" />
</h:column>
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST_USER_FAMILY_NAME}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_CONTACT_FAMILY_NAME}</f:facet>
<h:outputText value="#{user.userContact.contactFamilyName}" />
</h:column>
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST_USER_ACCOUNT_STATUS}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_USER_ACCOUNT_STATUS}</f:facet>
<h:outputText styleClass="#{user.userAccountStatus.styleClass}" value="#{msg[user.userAccountStatus.messageKey]}" />
</h:column>
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST_USER_PROFILE_MODE}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_USER_PROFILE_MODE}</f:facet>
<h:outputText value="#{msg[user.userProfileMode.messageKey]}" />
</h:column>
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST_USER_CREATED}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_USER_CREATED}</f:facet>
<h:outputText id="userCreated" value="#{user.userCreated.time}">
<f:convertDateTime for="userCreated" type="both" timeStyle="short" dateStyle="short" />