]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Refactured a lot:
authorRoland Häder <roland@mxchange.org>
Wed, 27 Apr 2016 08:54:32 +0000 (10:54 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 27 Apr 2016 20:14:21 +0000 (22:14 +0200)
- 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@mxchange.org>
16 files changed:
src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/customer/PizzaAdminCustomerWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/customer/PizzaAdminCustomerWebRequestController.java
src/java/org/mxchange/pizzaapplication/beans/customer/PizzaCustomerWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/customer/PizzaCustomerWebSessionController.java
src/java/org/mxchange/pizzaapplication/beans/helper/PizzaAdminWebRequestController.java
src/java/org/mxchange/pizzaapplication/beans/helper/PizzaAdminWebRequestHelper.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestController.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionController.java
web/admin/contact/admin_contact_list.xhtml
web/admin/customer/admin_customer_list.xhtml
web/admin/user/admin_user_list.xhtml

index 3058b5b16ad0875258a715db71ddeb1cdd1c9e2e..61aa88636f30b86cdbbf90a257cdc92562520bc7 100644 (file)
@@ -337,3 +337,7 @@ ADMIN_SELECT_CUSTOMER_CONTACT=Kontakt zum Verkn\u00fcpfen ausw\u00e4hlen:
 ADMIN_CONTACT_CREATED=Erstellt:
 ADMIN_ADD_CONTACT_TITLE=Neue Kontaktdaten hinzuf\u00fcgen
 BUTTON_ADMIN_ADD_CONTACT=Kontaktdaten hinzuf\u00fcgen
+CONTACT_IS_UNUSED=Nicht verlinkt
+CONTACT_IS_USER_CUSTOMER=Benutzer und Kunde
+CONTACT_IS_USER=Ist Benutzer
+CONTACT_IS_CUSTOMER=Ist Kunde
index 92aef3691c29e5634dd8ff7fddc84c1ccb3e6c3b..5aaa3a611e55b11aff3b25e0c8f8d8dca6b7e7ea 100644 (file)
@@ -338,3 +338,7 @@ ADMIN_SELECT_CUSTOMER_CONTACT=Select contact for linking:
 ADMIN_CONTACT_CREATED=Created:
 ADMIN_ADD_CONTACT_TITLE=Add new contact data
 BUTTON_ADMIN_ADD_CONTACT=Add contact data
+CONTACT_IS_UNUSED=Not linked
+CONTACT_IS_USER_CUSTOMER=User and customer
+CONTACT_IS_USER=Is a user
+CONTACT_IS_CUSTOMER=Is a customer
index 94246d5ee2e7688b10c2ca88489d4c40640346c9..43079c27f5fff7abde0784c9a782f181a80c6d75 100644 (file)
@@ -113,7 +113,7 @@ public class PizzaAdminContactWebRequestBean implements PizzaAdminContactWebRequ
         * General contact controller
         */
        @Inject
-       private RateCalcContactWebSessionController contactController;
+       private PizzaContactWebSessionController contactController;
 
        /**
         * Contact id
index 2a7a49b10c36001f7ca53e8893c3c36dd43c3cd3..7c9bbd62b4c1d20268e4e6b142d807e9aeaf0f09 100644 (file)
@@ -16,8 +16,6 @@
  */
 package org.mxchange.pizzaapplication.beans.customer;
 
-import java.util.Collections;
-import java.util.List;
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
@@ -72,9 +70,10 @@ public class PizzaAdminCustomerWebRequestBean implements PizzaAdminCustomerWebRe
        private Event<AdminAddedCustomerEvent> customerAddedEvent;
 
        /**
-        * A list of all customers
+        * General customer controller
         */
-       private List<Customer> customerList;
+       @Inject
+       private PizzaCustomerWebSessionController customerController;
 
        /**
         * Default constructor
@@ -122,7 +121,7 @@ public class PizzaAdminCustomerWebRequestBean implements PizzaAdminCustomerWebRe
                }
 
                // Add customer to list
-               this.customerList.add(updatedCustomer);
+               this.customerController.addCustomer(updatedCustomer);
 
                // Fire event
                this.customerAddedEvent.fire(new CustomerAdminAddedEvent(updatedCustomer));
@@ -131,24 +130,11 @@ public class PizzaAdminCustomerWebRequestBean implements PizzaAdminCustomerWebRe
                return "admin_list_customer"; //NOI18N
        }
 
-       @Override
-       public List<Customer> allCustomers () {
-               // Return it
-               return Collections.unmodifiableList(this.customerList);
-       }
-
-       @Override
-       public boolean hasCustomers () {
-               return (!this.allCustomers().isEmpty());
-       }
-
        /**
         * Post-initialization of this class
         */
        @PostConstruct
        public void init () {
-               // Initialize customer list
-               this.customerList = this.adminCustomerBean.allCustomers();
        }
 
        /**
index 9aa71b0e8b443186b04dd79e3d5b6b0f050b9d11..3bdcd59a443b406d8a5e00dcaa6539f25989e46e 100644 (file)
@@ -17,8 +17,6 @@
 package org.mxchange.pizzaapplication.beans.customer;
 
 import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jcustomercore.model.customer.Customer;
 
 /**
  * An interface for user beans
@@ -27,20 +25,6 @@ import org.mxchange.jcustomercore.model.customer.Customer;
  */
 public interface PizzaAdminCustomerWebRequestController extends Serializable {
 
-       /**
-        * All customer
-        * <p>
-        * @return A list of all customer profiles
-        */
-       List<Customer> allCustomers ();
-
-       /**
-        * Checks whether customers are registered
-        * <p>
-        * @return Whether customers are registered
-        */
-       boolean hasCustomers ();
-
        /**
         * Adds customer to database if not already added. This method should return
         * a redirect outcome on success.
index 71aa303bc08eb060154851d299cf23803530274c..a82e358cc8b5077d5c475a365527ecdb6a2b0c74 100644 (file)
  */
 package org.mxchange.pizzaapplication.beans.customer;
 
+import java.text.MessageFormat;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Objects;
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
 import javax.faces.view.facelets.FaceletException;
+import javax.inject.Inject;
 import javax.inject.Named;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jcontacts.contact.UserContact;
-import org.mxchange.jcontacts.contact.gender.Gender;
-import org.mxchange.jcountry.data.Country;
+import org.mxchange.jcustomercore.events.AdminAddedCustomerEvent;
 import org.mxchange.jcustomercore.model.customer.Customer;
-import org.mxchange.jcustomercore.model.customer.CustomerSessionBeanRemote;
-import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jshopcore.model.customer.ShopCustomer;
+import org.mxchange.pizzaapplication.beans.contact.PizzaAdminContactWebRequestController;
+import org.mxchange.pizzaapplication.model.customer.PizzaAdminCustomerSessionBeanRemote;
 
 /**
  * A customer bean which hides the customer instance
@@ -45,93 +49,42 @@ public class PizzaCustomerWebSessionBean implements PizzaCustomerWebSessionContr
        /**
         * Serial number
         */
-       private static final long serialVersionUID = 542_145_347_916L;
+       private static final long serialVersionUID = 12_487_062_487_527_913L;
 
-       /////////////////////// Properties /////////////////////
        /**
-        * Cellphone number
+        * Administrative contact controller (for personal data)
         */
-       private DialableCellphoneNumber cellphoneNumber;
+       @Inject
+       private PizzaAdminContactWebRequestController adminContactController;
 
        /**
-        * City
+        * Administrative customer EJB
         */
-       private String city;
+       private PizzaAdminCustomerSessionBeanRemote adminCustomerBean;
 
        /**
-        * Optional comments
+        * An event being fired when an administrator has added a new customer
         */
-       private String comment;
+       @Inject
+       @Any
+       private Event<AdminAddedCustomerEvent> customerAddedEvent;
 
        /**
-        * Country code
+        * A list of all customers
         */
-       private Country country;
-
-       /**
-        * Remote customer bean
-        */
-       private CustomerSessionBeanRemote customerBean;
-
-       /**
-        * Email address
-        */
-       private String emailAddress;
-
-       /**
-        * Family name
-        */
-       private String familyName;
-
-       /**
-        * Fax number
-        */
-       private DialableFaxNumber faxNumber;
-
-       /**
-        * First name
-        */
-       private String firstName;
-
-       /**
-        * Gender instance
-        */
-       private Gender gender;
-
-       /**
-        * House number
-        */
-       private Short houseNumber;
-
-       /**
-        * Phone number
-        */
-       private DialableLandLineNumber phoneNumber;
-
-       /**
-        * Street
-        */
-       private String street;
-
-       /**
-        * ZIP code
-        */
-       private Integer zipCode;
+       private List<Customer> customerList;
 
        /**
         * Default constructor
         */
        public PizzaCustomerWebSessionBean () {
-               // Set gender to UNKNOWN
-               this.gender = Gender.UNKNOWN;
-
                // Try it
                try {
                        // Get initial context
                        Context context = new InitialContext();
 
                        // Try to lookup
-                       this.customerBean = (CustomerSessionBeanRemote) context.lookup("java:global/jshop-ejb/shop_customer!org.mxchange.jcustomercore.model.customer.CustomerSessionBeanRemote"); //NOI18N
+                       this.adminCustomerBean = (PizzaAdminCustomerSessionBeanRemote) context.lookup("java:global/jratecalc-ejb/admincustomer!de.chotime.jratecalc.model.customer.PizzaAdminCustomerSessionBeanRemote"); //NOI18N
                } catch (final NamingException e) {
                        // Throw again
                        throw new FaceletException(e);
@@ -139,159 +92,87 @@ public class PizzaCustomerWebSessionBean implements PizzaCustomerWebSessionContr
        }
 
        @Override
-       public Customer createCustomerInstance () {
-               // Trace message
-               //this.getLogger().logTrace("createInstance: CALLED!");
-
-               // Required personal data must be set
-               assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
-
-               // Create new customer instance
-               Customer customer = new ShopCustomer();
-
-               // Create new contact
-               Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
-               contact.setContactStreet(this.getStreet());
-               contact.setContactHouseNumber(this.getHouseNumber());
-               contact.setContactZipCode(this.getZipCode());
-               contact.setContactCity(this.getCity());
-               contact.setContactCountry(this.getCountry());
-               contact.setContactLandLineNumber(this.getPhoneNumber());
-               contact.setContactFaxNumber(this.getFaxNumber());
-               contact.setContactCellphoneNumber(this.getCellphoneNumber());
-
-               // Set contact in customer
-               customer.setCustomerContact(contact);
-
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("createInstance: customer={0} - EXIT!", customer));
-               // Return it
-               return customer;
-       }
-
-       @Override
-       public DialableCellphoneNumber getCellphoneNumber () {
-               return this.cellphoneNumber;
-       }
-
-       @Override
-       public void setCellphoneNumber (final DialableCellphoneNumber cellphoneNumber) {
-               this.cellphoneNumber = cellphoneNumber;
-       }
-
-       @Override
-       public String getCity () {
-               return this.city;
-       }
-
-       @Override
-       public void setCity (final String city) {
-               this.city = city;
-       }
-
-       @Override
-       public Country getCountry () {
-               return this.country;
-       }
-
-       @Override
-       public void setCountry (final Country country) {
-               this.country = country;
-       }
-
-       @Override
-       public String getEmailAddress () {
-               return this.emailAddress;
-       }
-
-       @Override
-       public void setEmailAddress (final String emailAddress) {
-               this.emailAddress = emailAddress;
-       }
-
-       @Override
-       public String getFamilyName () {
-               return this.familyName;
-       }
-
-       @Override
-       public void setFamilyName (final String familyName) {
-               this.familyName = familyName;
-       }
-
-       @Override
-       public DialableFaxNumber getFaxNumber () {
-               return this.faxNumber;
-       }
-
-       @Override
-       public void setFaxNumber (final DialableFaxNumber faxNumber) {
-               this.faxNumber = faxNumber;
-       }
-
-       @Override
-       public String getFirstName () {
-               return this.firstName;
-       }
-
-       @Override
-       public void setFirstName (final String firstName) {
-               this.firstName = firstName;
-       }
-
-       @Override
-       public Gender getGender () {
-               return this.gender;
-       }
+       public void addCustomer (final Customer customer) {
+               // The contact must be valid
+               if (null == customer) {
+                       // Throw NPE
+                       throw new NullPointerException("customer is null"); //NOI18N
+               } else if (customer.getCustomerId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("customer.customerId is null"); //NOI18N
+               } else if (customer.getCustomerId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("customer.customerId={0} is not valid", customer.getCustomerId())); //NOI18N
+               } else if (customer.getCustomerContact() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("customer.customerContact is null"); //NOI18N
+               } else if (customer.getCustomerContact().getContactId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("customer.customerContact.contactId is null"); //NOI18N
+               } else if (customer.getCustomerContact().getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("customer.customerContact.contactId={0} is not valid", customer.getCustomerContact().getContactId())); //NOI18N
+               }
 
-       @Override
-       public void setGender (final Gender gender) {
-               this.gender = gender;
+               // Add to list
+               this.customerList.add(customer);
        }
 
        @Override
-       public Short getHouseNumber () {
-               return this.houseNumber;
+       public List<Customer> allCustomers () {
+               // Return it
+               return Collections.unmodifiableList(this.customerList);
        }
 
        @Override
-       public void setHouseNumber (final Short houseNumber) {
-               this.houseNumber = houseNumber;
+       public boolean hasCustomers () {
+               return (!this.allCustomers().isEmpty());
        }
 
-       @Override
-       public DialableLandLineNumber getPhoneNumber () {
-               return this.phoneNumber;
+       /**
+        * Post-initialization of this class
+        */
+       @PostConstruct
+       public void init () {
+               // Initialize customer list
+               this.customerList = this.adminCustomerBean.allCustomers();
        }
 
        @Override
-       public void setPhoneNumber (final DialableLandLineNumber phoneNumber) {
-               this.phoneNumber = phoneNumber;
-       }
+       public boolean isContactFound (final Contact contact) {
+               // The contact must be valid
+               if (null == contact) {
+                       // Throw NPE
+                       throw new NullPointerException("contact is null"); //NOI18N
+               } else if (contact.getContactId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("contact.contactId is null"); //NOI18N
+               } else if (contact.getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
+               }
 
-       @Override
-       public String getStreet () {
-               return this.street;
-       }
+               // Default is not found
+               boolean isFound = false;
 
-       @Override
-       public void setStreet (final String street) {
-               this.street = street;
-       }
+               // Get iterator
+               Iterator<Customer> iterator = this.allCustomers().iterator();
 
-       @Override
-       public Integer getZipCode () {
-               return this.zipCode;
-       }
+               // Loop through all entries
+               while (iterator.hasNext()) {
+                       // Get customer
+                       Customer next = iterator.next();
 
-       @Override
-       public void setZipCode (final Integer zipCode) {
-               this.zipCode = zipCode;
-       }
+                       // Compare both objects
+                       if (Objects.equals(contact, next.getCustomerContact())) {
+                               // Found it
+                               isFound = true;
+                               break;
+                       }
+               }
 
-       @Override
-       public boolean isRequiredPersonalDataSet () {
-               return ((this.getGender() != null) && (this.getFirstName() != null) && (this.getFamilyName() != null) && (this.getStreet() != null) && (this.getHouseNumber() != null) && (this.getZipCode() != null) && (this.getCity() != null));
+               // Return status
+               return isFound;
        }
 
 }
index d7a2e4791403cd4901044688a8e038180dc50c0a..098f529bdcef38d1f0b573083d15249962507649 100644 (file)
 package org.mxchange.pizzaapplication.beans.customer;
 
 import java.io.Serializable;
-import org.mxchange.jcontacts.contact.gender.Gender;
-import org.mxchange.jcountry.data.Country;
+import java.util.List;
+import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jcustomercore.model.customer.Customer;
-import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
 
 /**
  * An interface for customer beans
@@ -32,185 +29,34 @@ import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
 public interface PizzaCustomerWebSessionController extends Serializable {
 
        /**
-        * Creates an instance from all properties
+        * Adds customer instance to list. The customer should be an updated
+        * instance (with id number).
         * <p>
-        * @return A Customer instance
+        * @param customer Customer instance
         */
-       Customer createCustomerInstance ();
+       void addCustomer (final Customer customer);
 
        /**
-        * Cellphone number
+        * Checks whether the given contact is a customer
         * <p>
-        * @return the cellphoneNumber
+        * @param contact Contact to check
+        *
+        * @return Whether the contact is a customer
         */
-       DialableCellphoneNumber getCellphoneNumber ();
+       boolean isContactFound (final Contact contact);
 
        /**
-        * Cellphone number
+        * All customer
         * <p>
-        * @param cellphoneNumber the cellphoneNumber to set
+        * @return A list of all customer profiles
         */
-       void setCellphoneNumber (final DialableCellphoneNumber cellphoneNumber);
+       List<Customer> allCustomers ();
 
        /**
-        * City
+        * Checks whether customers are registered
         * <p>
-        * @return the city
+        * @return Whether customers are registered
         */
-       String getCity ();
-
-       /**
-        * City
-        * <p>
-        * @param city the city to set
-        */
-       void setCity (final String city);
-
-       /**
-        * Getter for country instance
-        * <p>
-        * @return Country instance
-        */
-       Country getCountry ();
-
-       /**
-        * Setter for country instance
-        * <p>
-        * @param country Country instance
-        */
-       void setCountry (final Country country);
-
-       /**
-        * Email address
-        * <p>
-        * @return the emailAddress
-        */
-       String getEmailAddress ();
-
-       /**
-        * Email address
-        * <p>
-        * @param emailAddress the emailAddress to set
-        */
-       void setEmailAddress (final String emailAddress);
-
-       /**
-        * Family name
-        * <p>
-        * @return the familyName
-        */
-       String getFamilyName ();
-
-       /**
-        * Family name
-        * <p>
-        * @param familyName the familyName to set
-        */
-       void setFamilyName (final String familyName);
-
-       /**
-        * Fax number
-        * <p>
-        * @return the faxNumber
-        */
-       DialableFaxNumber getFaxNumber ();
-
-       /**
-        * Fax number
-        * <p>
-        * @param faxNumber the faxNumber to set
-        */
-       void setFaxNumber (final DialableFaxNumber faxNumber);
-
-       /**
-        * First name
-        * <p>
-        * @return the first name
-        */
-       String getFirstName ();
-
-       /**
-        * First name
-        * <p>
-        * @param firstName the first name to set
-        */
-       void setFirstName (final String firstName);
-
-       /**
-        * Gender of the contact
-        * <p>
-        * @return the gender
-        */
-       Gender getGender ();
-
-       /**
-        * Gender of the contact
-        * <p>
-        * @param gender the gender to set
-        */
-       void setGender (final Gender gender);
-
-       /**
-        * House number
-        * <p>
-        * @return the houseNumber
-        */
-       Short getHouseNumber ();
-
-       /**
-        * House number
-        * <p>
-        * @param houseNumber the houseNumber to set
-        */
-       void setHouseNumber (final Short houseNumber);
-
-       /**
-        * Phone number
-        * <p>
-        * @return the phoneNumber
-        */
-       DialableLandLineNumber getPhoneNumber ();
-
-       /**
-        * Phone number
-        * <p>
-        * @param phoneNumber the phoneNumber to set
-        */
-       void setPhoneNumber (final DialableLandLineNumber phoneNumber);
-
-       /**
-        * Street
-        * <p>
-        * @return the street
-        */
-       String getStreet ();
-
-       /**
-        * Street
-        * <p>
-        * @param street the street to set
-        */
-       void setStreet (final String street);
-
-       /**
-        * ZIP code
-        * <p>
-        * @return the zipCode
-        */
-       Integer getZipCode ();
-
-       /**
-        * ZIP code
-        * <p>
-        * @param zipCode the zipCode to set
-        */
-       void setZipCode (final Integer zipCode);
-
-       /**
-        * Checks whether all required personal data is set
-        * <p>
-        * @return Whether the required personal data is set
-        */
-       boolean isRequiredPersonalDataSet ();
+       boolean hasCustomers ();
 
 }
index 1ff3f0b611f793f8882d4fb3f172a2f696a713e9..d867fd8ae8e52ad47e2c0a7e39883feaec30e874 100644 (file)
@@ -46,6 +46,16 @@ public interface PizzaAdminWebRequestController extends Serializable {
         */
        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 getUserCustomerUsageMessageKey (final Contact contact);
+
        /**
         * Getter for contact instance
         * <p>
index 6d538c2327436ccd955d313f0a883352898006bd..98f3d284ead74afd02169dcd51256c99c46f9996 100644 (file)
@@ -23,7 +23,10 @@ import javax.inject.Named;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.pizzaapplication.beans.contact.PizzaAdminContactWebRequestController;
+import org.mxchange.pizzaapplication.beans.customer.PizzaAdminCustomerWebRequestController;
+import org.mxchange.pizzaapplication.beans.customer.PizzaCustomerWebSessionController;
 import org.mxchange.pizzaapplication.beans.user.PizzaAdminUserWebRequestController;
+import org.mxchange.pizzaapplication.beans.user.PizzaUserWebSessionController;
 
 /**
  * A general helper for administrative beans
@@ -40,13 +43,19 @@ public class PizzaAdminWebRequestHelper implements PizzaAdminWebRequestControlle
        private static final long serialVersionUID = 17_258_793_567_145_701L;
 
        /**
-        * Admin contact controller
+        * Administrative contact controller
         */
        @Inject
        private PizzaAdminContactWebRequestController adminContactController;
 
        /**
-        * Admin user controller
+        * Administrative user controller
+        */
+       @Inject
+       private PizzaAdminCustomerWebRequestController adminCustomerController;
+
+       /**
+        * Administrative user controller
         */
        @Inject
        private PizzaAdminUserWebRequestController adminUserController;
@@ -56,11 +65,23 @@ public class PizzaAdminWebRequestHelper implements PizzaAdminWebRequestControlle
         */
        private Contact contact;
 
+       /**
+        * General user controller
+        */
+       @Inject
+       private PizzaCustomerWebSessionController customerController;
+
        /**
         * User instance
         */
        private User user;
 
+       /**
+        * General user controller
+        */
+       @Inject
+       private PizzaUserWebSessionController userController;
+
        /**
         * Default constructor
         */
@@ -70,7 +91,7 @@ public class PizzaAdminWebRequestHelper implements PizzaAdminWebRequestControlle
        @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) {
@@ -88,13 +109,13 @@ public class PizzaAdminWebRequestHelper implements PizzaAdminWebRequestControlle
                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
-               System.out.println("AdminHelper::copyUserToController - CALLED!"); //NOI18N
+               //* NOISY-DEBUG: */ System.out.println("AdminHelper::copyUserToController - CALLED!"); //NOI18N
 
                // Validate user instance
                if (this.getUser() == null) {
@@ -112,7 +133,7 @@ public class PizzaAdminWebRequestHelper implements PizzaAdminWebRequestControlle
                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
@@ -135,4 +156,41 @@ public class PizzaAdminWebRequestHelper implements PizzaAdminWebRequestControlle
                this.user = user;
        }
 
+       @Override
+       public String getUserCustomerUsageMessageKey (final Contact contact) {
+               // The contact must be valid
+               if (null == contact) {
+                       // Throw NPE
+                       throw new NullPointerException("contact is null"); //NOI18N
+               } else if (contact.getContactId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("contact.contactId is null"); //NOI18N
+               } else if (contact.getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
+               }
+
+               // Default key is "unused"
+               String messageKey = "CONTACT_IS_UNUSED"; //NOI18N
+
+               // Check user/customer
+               boolean isUserContact = this.userController.isContactFound(contact);
+               boolean isCustomerContact = this.customerController.isContactFound(contact);
+
+               // Check user first
+               if (isUserContact && isCustomerContact) {
+                       // Is both
+                       messageKey = "CONTACT_IS_USER_CUSTOMER"; //NOI18N
+               } else if (isUserContact) {
+                       // Only user
+                       messageKey = "CONTACT_IS_USER"; //NOI18N
+               } else if (isCustomerContact) {
+                       // Only customer
+                       messageKey = "CONTACT_IS_CUSTOMER"; //NOI18N
+               }
+
+               // Return message key
+               return messageKey;
+       }
+
 }
index 6000c201b65293f86e47a0b7b422109f06a6076e..088d747a2dc0fc976fcb21ab41e981d753e84930 100644 (file)
 package org.mxchange.pizzaapplication.beans.user;
 
 import java.text.MessageFormat;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
 import java.util.Objects;
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
-import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Any;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
@@ -38,10 +34,8 @@ import org.mxchange.jusercore.events.user.AdminAddedUserEvent;
 import org.mxchange.jusercore.events.user.AdminUserAddedEvent;
 import org.mxchange.jusercore.events.user.update.AdminUpdatedUserDataEvent;
 import org.mxchange.jusercore.events.user.update.AdminUserDataUpdatedEvent;
-import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
 import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
-import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.exceptions.UserPasswordRepeatMismatchException;
 import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
@@ -103,11 +97,6 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon
        @Inject
        private PizzaUserWebSessionController userController;
 
-       /**
-        * A list of all user profiles
-        */
-       private List<User> userList;
-
        /**
         * User name
         */
@@ -169,13 +158,13 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon
                        } 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()) {
@@ -248,7 +237,7 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon
                                // Add new contact
                                updatedUser = this.userBean.addUser(user);
                        }
-                       } catch (final UserNameAlreadyRegisteredException | EmailAddressAlreadyRegisteredException ex) {
+               } catch (final UserNameAlreadyRegisteredException | EmailAddressAlreadyRegisteredException ex) {
                        // Throw again
                        throw new FaceletException(ex);
                }
@@ -256,9 +245,6 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon
                // Fire event
                this.addedUserEvent.fire(new AdminUserAddedEvent(updatedUser));
 
-               // Add user to local list
-               this.userList.add(updatedUser);
-
                // Clear contact instance
                this.contactController.clear();
 
@@ -266,33 +252,6 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon
                return "admin_list_user"; //NOI18N
        }
 
-       @Override
-       public void afterUserUpdatedPersonalData (@Observes final UpdatedUserPersonalDataEvent event) {
-               // Check parameter
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getUpdatedUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.updatedUser is null"); //NOI18N
-               } else if (event.getUpdatedUser().getUserId() == null) {
-                       // ... and again
-                       throw new NullPointerException("event.updatedUser.userId is null"); //NOI18N
-               } else if (event.getUpdatedUser().getUserId() < 1) {
-                       // Invalid value
-                       throw new IllegalArgumentException(MessageFormat.format("event.updatedUser.userId={0} is in valid", event.getUpdatedUser().getUserId())); //NOI18N
-               }
-
-               // All fine, so update list
-               this.updateList(event.getUpdatedUser());
-       }
-
-       @Override
-       public List<User> allUsers () {
-               // Return it
-               return Collections.unmodifiableList(this.userList);
-       }
-
        @Override
        public String changeUserData () {
                // Get user instance
@@ -351,7 +310,7 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon
                User updatedUser = this.userBean.updateUserData(user);
 
                // Update list
-               this.updateList(updatedUser);
+               this.userController.updateList(updatedUser);
 
                // Fire event
                this.updatedUserDataEvent.fire(new AdminUserDataUpdatedEvent(updatedUser));
@@ -390,55 +349,11 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon
                this.userPasswordRepeat = userPasswordRepeat;
        }
 
-       @Override
-       public boolean hasUsers () {
-               return (!this.allUsers().isEmpty());
-       }
-
        /**
         * Post-initialization of this class
         */
        @PostConstruct
        public void init () {
-               // Initialize user list
-               this.userList = this.userBean.allUsers();
-       }
-
-       @Override
-       public User lookupUserById (final Long userId) throws UserNotFoundException {
-               // Parameter must be valid
-               if (null == userId) {
-                       // Throw NPE
-                       throw new NullPointerException("userId is null"); //NOI18N
-               } else if (userId < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("userId={0} is not valid.", userId)); //NOI18N
-               }
-
-               // Init variable
-               User user = null;
-
-               // Try to lookup it in visible user list
-               for (final Iterator<User> iterator = this.userList.iterator(); iterator.hasNext();) {
-                       // Get next user
-                       User next = iterator.next();
-
-                       // Is the user id found?
-                       if (Objects.equals(next.getUserId(), userId)) {
-                               // Copy to other variable
-                               user = next;
-                               break;
-                       }
-               }
-
-               // Is it still null?
-               if (null == user) {
-                       // Not visible for the current user
-                       throw new UserNotFoundException(userId);
-               }
-
-               // Return it
-               return user;
        }
 
        /**
@@ -450,42 +365,4 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon
                return ((!this.getUserPassword().isEmpty()) && (Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat())));
        }
 
-       /**
-        * Updates list with given user instance
-        * <p>
-        * @param user User instance
-        */
-       private void updateList (final User user) {
-               // The user should be valid
-               if (null == user) {
-                       // Throw NPE
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() == null) {
-                       // ... again NPE
-                       throw new NullPointerException("user.userId is null"); //NOI18N
-               } else if (user.getUserId() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is invalid", user.getUserId())); //NOI18N
-               }
-
-               // Get iterator
-               Iterator<User> iterator = this.userList.iterator();
-
-               // Look whole list
-               while (iterator.hasNext()) {
-                       // Get next element
-                       User next = iterator.next();
-
-                       // Is the same user id?
-                       if (Objects.equals(user.getUserId(), next.getUserId())) {
-                               // Found it, so remove it
-                               this.userList.remove(next);
-                               break;
-                       }
-               }
-
-               // Re-add item
-               this.userList.add(user);
-       }
-
 }
index 9d787b11ed074ba7443521c82d07f1d67dad6a9b..9026a24d6c2d9b9a92e50b0907db286f93a34485 100644 (file)
 package org.mxchange.pizzaapplication.beans.user;
 
 import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
-import org.mxchange.jusercore.exceptions.UserNotFoundException;
-import org.mxchange.jusercore.model.user.User;
 
 /**
  * An interface for user beans
@@ -29,39 +25,6 @@ import org.mxchange.jusercore.model.user.User;
  */
 public interface PizzaAdminUserWebRequestController extends Serializable {
 
-       /**
-        * Listens to fired event when user updated personal data
-        * <p>
-        * @param event Event being fired
-        */
-       void afterUserUpdatedPersonalData (final UpdatedUserPersonalDataEvent event);
-
-       /**
-        * Tries to lookup user by given id number. If the user is not found or the
-        * account status is not CONFIRMED proper exceptions are thrown.
-        * <p>
-        * @param userId User id
-        * <p>
-        * @return User instance
-        * <p>
-        * @throws UserNotFoundException If the user is not found
-        */
-       User lookupUserById (final Long userId) throws UserNotFoundException;
-
-       /**
-        * All users
-        * <p>
-        * @return A list of all public user profiles
-        */
-       List<User> allUsers ();
-
-       /**
-        * Checks whether users are registered
-        * <p>
-        * @return Whether users are registered
-        */
-       boolean hasUsers ();
-
        /**
         * Adds user instance to database by preparing a complete user instance and
         * sending it to the EJB. The data set in the controller is being verified,
index 42a83a3aed1049592e1da1706586333b0ee7e669..ce8c1b7476e91d67388d21be307649612a1c4661 100644 (file)
@@ -16,8 +16,6 @@
  */
 package org.mxchange.pizzaapplication.beans.user;
 
-import de.chotime.jratecalc.beans.contact.RateCalcContactWebSessionController;
-import de.chotime.jratecalc.beans.login.RateCalcUserLoginWebSessionController;
 import java.text.MessageFormat;
 import java.util.Collections;
 import java.util.Iterator;
@@ -45,13 +43,13 @@ import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
 import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
 import org.mxchange.jusercore.events.user.update.UserUpdatedPersonalDataEvent;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
+import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
 import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
-import org.mxchange.pizzaapplication.beans.login.PizzaUserLoginWebSessionController;
 import org.mxchange.pizzaapplication.beans.contact.PizzaContactWebSessionController;
-import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
+import org.mxchange.pizzaapplication.beans.login.PizzaUserLoginWebSessionController;
 
 /**
  * A user bean (controller)
@@ -71,7 +69,7 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
         * Administrative user controller
         */
        @Inject
-       private RateCalcAdminUserWebRequestController adminController;
+       private PizzaAdminUserWebRequestController adminController;
 
        /**
         * Remote user bean
@@ -112,6 +110,11 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
         */
        private Long userId;
 
+       /**
+        * A list of all user profiles
+        */
+       private List<User> userList;
+
        /**
         * User name
         */
@@ -200,6 +203,9 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
                // Set user id again
                this.setUserId(registeredUser.getUserId());
 
+               // Add user to local list
+               this.userList.add(registeredUser);
+
                // Is the account public?
                if (Objects.equals(registeredUser.getUserProfileMode(), ProfileMode.PUBLIC)) {
                        // Also add it to this list
@@ -241,6 +247,9 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
 
                // Remove this contact from selectable list
                assert(this.selectableContacts.remove(event.getAddedUser().getUserContact())) : "contact was not removed"; //NOI18N
+
+               // Add user to local list
+               this.userList.add(event.getAddedUser());
        }
 
        @Override
@@ -273,6 +282,12 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
                System.out.println(MessageFormat.format("UserWebBean:afterUserLogin: this.visibleUserList.size()={0} - EXIT!", this.visibleUserList.size())); //NOI18N
        }
 
+       @Override
+       public List<User> allUsers () {
+               // Return it
+               return Collections.unmodifiableList(this.userList);
+       }
+
        @Override
        public List<User> allVisibleUsers () {
                // Return it
@@ -397,6 +412,11 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
                this.userProfileMode = userProfileMode;
        }
 
+       @Override
+       public boolean hasUsers () {
+               return (!this.allUsers().isEmpty());
+       }
+
        /**
         * Post-initialization of this class
         */
@@ -413,9 +433,8 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
                        // Initialize user list
                        this.visibleUserList = this.userBean.allPublicUsers();
                }
-
-               // Get all users
-               List<User> allUsers = this.adminController.allUsers();
+               // Initialize user list
+               this.userList = this.userBean.allUsers();
 
                // Get all contacts
                List<Contact> allContacts = this.contactBean.getAllContacts();
@@ -429,7 +448,7 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
                        Contact next = iterator.next();
 
                        // Get iterator
-                       Iterator<User> userIterator = allUsers.iterator();
+                       Iterator<User> userIterator = this.userList.iterator();
 
                        // Loop through all users
                        while (userIterator.hasNext()) {
@@ -449,6 +468,64 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
                this.selectableContacts = allContacts;
        }
 
+       @Override
+       public boolean isContactFound (final Contact contact) {
+               // The contact must be valid
+               if (null == contact) {
+                       // Throw NPE
+                       throw new NullPointerException("contact is null"); //NOI18N
+               } else if (contact.getContactId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("contact.contactId is null"); //NOI18N
+               } else if (contact.getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
+               }
+
+               // Default is not found
+               boolean isFound = false;
+
+               // Get iterator
+               Iterator<User> iterator = this.allUsers().iterator();
+
+               // Loop through all entries
+               while (iterator.hasNext()) {
+                       // Get user
+                       User next = iterator.next();
+
+                       // Compare both objects
+                       if (Objects.equals(contact, next.getUserContact())) {
+                               // Found it
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               // Return status
+               return isFound;
+       }
+
+       @Override
+       public void afterUserUpdatedPersonalData (@Observes final UpdatedUserPersonalDataEvent event) {
+               // Check parameter
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getUpdatedUser() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedUser is null"); //NOI18N
+               } else if (event.getUpdatedUser().getUserId() == null) {
+                       // ... and again
+                       throw new NullPointerException("event.updatedUser.userId is null"); //NOI18N
+               } else if (event.getUpdatedUser().getUserId() < 1) {
+                       // Invalid value
+                       throw new IllegalArgumentException(MessageFormat.format("event.updatedUser.userId={0} is in valid", event.getUpdatedUser().getUserId())); //NOI18N
+               }
+
+               // All fine, so update list
+               this.updateList(event.getUpdatedUser());
+       }
+
        @Override
        public boolean isRequiredChangePersonalDataSet () {
                return ((this.getUserProfileMode() != null) &&
@@ -547,6 +624,45 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
                this.contactController.addEmailAddress(user.getUserContact().getContactEmailAddress());
        }
 
+       /**
+        * Updates list with given user instance
+        * <p>
+        * @param user User instance
+        */
+       @Override
+       public void updateList (final User user) {
+               // The user should be valid
+               if (null == user) {
+                       // Throw NPE
+                       throw new NullPointerException("user is null"); //NOI18N
+               } else if (user.getUserId() == null) {
+                       // ... again NPE
+                       throw new NullPointerException("user.userId is null"); //NOI18N
+               } else if (user.getUserId() < 1) {
+                       // Invalid id
+                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is invalid", user.getUserId())); //NOI18N
+               }
+
+               // Get iterator
+               Iterator<User> iterator = this.userList.iterator();
+
+               // Look whole list
+               while (iterator.hasNext()) {
+                       // Get next element
+                       User next = iterator.next();
+
+                       // Is the same user id?
+                       if (Objects.equals(user.getUserId(), next.getUserId())) {
+                               // Found it, so remove it
+                               this.userList.remove(next);
+                               break;
+                       }
+               }
+
+               // Re-add item
+               this.userList.add(user);
+       }
+
        /**
         * Clears this bean
         */
index 19fef777cf21eeb4f88d78552e12b38df2b5de42..aecd5490bd68ab23a3c816558dc449ee6f941d5e 100644 (file)
@@ -22,6 +22,7 @@ import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
+import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
@@ -38,6 +39,38 @@ public interface PizzaUserWebSessionController extends Serializable {
         */
        public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
 
+       /**
+        * All users
+        * <p>
+        * @return A list of all public user profiles
+        */
+       List<User> allUsers ();
+
+       /**
+        * Checks whether users are registered
+        * <p>
+        * @return Whether users are registered
+        */
+       boolean hasUsers ();
+
+       /**
+        * Checks whether the given contact is a user
+        * <p>
+        * @param contact Contact to check
+        * <p>
+        * @return Whether the contact is a user
+        */
+       boolean isContactFound (final Contact contact);
+
+       /**
+        * Listens to fired event when user updated personal data
+        * <p>
+        * @param event Event being fired
+        */
+       void afterUserUpdatedPersonalData (final UpdatedUserPersonalDataEvent event);
+
+       void updateList (final User user);
+
        /**
         * Returns a list of all selectable contacts for user creation. Contacts
         * from already existing users are excluded in this list.
@@ -63,7 +96,7 @@ public interface PizzaUserWebSessionController extends Serializable {
         * <p>
         * @param event Event being fired
         */
-       void afterAdminAddedUserEvent(final AdminAddedUserEvent event);
+       void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
 
        /**
         * Event observer for new user registrations
index 1cdec6f356fe2c543d5558c2c3b2a225cc1ce75f..1284bea1fea4c025f9f4f2c9c372ba4590abd321 100644 (file)
                                        <h:outputText value="#{contact.contactFamilyName}" />
                                </h:column>
 
+                               <h:column>
+                                       <f:facet name="header">#{msg.ADMIN_CONTACT_USER_CUSTOMER_USAGE}</f:facet>
+
+                                       <h:outputText value="#{msg[adminHelper.getUserCustomerUsageMessageKey(contact)]}" />
+                               </h:column>
+
                                <h:column>
                                        <f:facet name="header">#{msg.ADMIN_CONTACT_CREATED}</f:facet>
 
index 018692d4f6234159ef9ebbef519534fb3bd63ec5..6289a98925549c6de86e99d26bc9ceb57d6f83cc 100644 (file)
@@ -16,7 +16,7 @@
                </ui:define>
 
                <ui:define name="content">
-                       <h:dataTable id="table_list_customers" var="customer" value="#{adminCustomerController.allCustomers()}" styleClass="table_big" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_CUSTOMER}" rendered="#{adminCustomerController.hasCustomers()}">
+                       <h:dataTable id="table_list_customers" var="customer" value="#{customerController.allCustomers()}" styleClass="table_big" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_CUSTOMER}" rendered="#{customerController.hasCustomers()}">
                                <h:column>
                                        <f:facet name="header">#{msg.ADMIN_LIST_CUSTOMER_ID}</f:facet>
 
                                </h:column>
 
                                <h:column>
-                                       <f:facet name="header">#{msg.ADMIN_LIST_CUSTOMER_GENDER}</f:facet>
+                                       <f:facet name="header">#{msg.ADMIN_CONTACT_GENDER}</f:facet>
 
                                        <h:outputText value="#{msg[customer.customerContact.contactGender.messageKey]}" />
                                </h:column>
 
                                <h:column>
-                                       <f:facet name="header">#{msg.ADMIN_LIST_CUSTOMER_FIRST_NAME}</f:facet>
+                                       <f:facet name="header">#{msg.ADMIN_CONTACT_FIRST_NAME}</f:facet>
 
                                        <h:outputText value="#{customer.customerContact.contactFirstName}" />
                                </h:column>
 
                                <h:column>
-                                       <f:facet name="header">#{msg.ADMIN_LIST_CUSTOMER_FAMILY_NAME}</f:facet>
+                                       <f:facet name="header">#{msg.ADMIN_CONTACT_FAMILY_NAME}</f:facet>
 
                                        <h:outputText value="#{customer.customerContact.contactFamilyName}" />
                                </h:column>
index c0168f1d14f3667c3cfdf4c7fb2be4a9bfa5fc2c..11ead762e7f4dfd3768a77e8369b73cd802f71ad 100644 (file)
@@ -16,9 +16,9 @@
                </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" />