]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Continued with contacts:
authorRoland Häder <roland@mxchange.org>
Wed, 27 Apr 2016 06:52:40 +0000 (08:52 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 27 Apr 2016 20:08:33 +0000 (22:08 +0200)
- added hasContacts() / allContacts()
- listing of contacts started, maybe later add a method that checks where the contact is being used and returns a message key?

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestController.java
src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebSessionController.java
web/WEB-INF/faces-config.xml
web/admin/contact/admin_contact_list.xhtml
web/admin/customer/admin_customer_list.xhtml

index 8e19458f970f7511c2977909beef2b5ad451d5da..94246d5ee2e7688b10c2ca88489d4c40640346c9 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.pizzaapplication.beans.contact;
 
 import java.text.MessageFormat;
 import java.util.Date;
+import java.util.List;
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
@@ -108,6 +109,12 @@ public class PizzaAdminContactWebRequestBean implements PizzaAdminContactWebRequ
         */
        private final ContactSessionBeanRemote contactBean;
 
+       /**
+        * General contact controller
+        */
+       @Inject
+       private RateCalcContactWebSessionController contactController;
+
        /**
         * Contact id
         */
@@ -235,6 +242,11 @@ public class PizzaAdminContactWebRequestBean implements PizzaAdminContactWebRequ
                }
        }
 
+       @Override
+       public List<Contact> allContacts () {
+               return this.contactController.allContacts();
+       }
+
        @Override
        public String changeContactData () {
                // Get contact instance
@@ -647,6 +659,11 @@ public class PizzaAdminContactWebRequestBean implements PizzaAdminContactWebRequ
                this.zipCode = zipCode;
        }
 
+       @Override
+       public boolean hasContacts () {
+               return (!this.allContacts().isEmpty());
+       }
+
        /**
         * Post-initialization of this class
         */
index 72b67b5dbf1b5913bf8cc6fe260d365718b6f885..e22b92de9935daf937139af8ddb6d7103c5ac3f0 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.pizzaapplication.beans.contact;
 
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jcontacts.contact.gender.Gender;
 import org.mxchange.jcountry.data.Country;
@@ -30,6 +31,20 @@ import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
  */
 public interface PizzaAdminContactWebRequestController extends Serializable {
 
+       /**
+        * Returns a list of all found contacts
+        * <p>
+        * @return A list of all contacts.
+        */
+       List<Contact> allContacts();
+
+       /**
+        * Checks whether there are contacts.
+        * <p>
+        * @return Whether contacts are there
+        */
+       boolean hasContacts ();
+
        /**
         * Creates an instance from contact data
         * <p>
index f8542a9ca3483b29785e32f286ae5183b1d09050..ec0e666b60ef3819a1514856608e63343c0b8d68 100644 (file)
@@ -338,6 +338,11 @@ public class PizzaContactWebSessionBean implements PizzaContactWebSessionControl
                System.out.println("ContactWebBean:afterUserLogin - EXIT!"); //NOI18N
        }
 
+       @Override
+       public List<Contact> allContacts () {
+               return this.contactList;
+       }
+
        /**
         * Clears this bean
         */
index 6316691d99e6ed504f61040b1ea775d78f058f25..4223b78eb10823428c1e01df8c12331ed8d64026 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.pizzaapplication.beans.contact;
 
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jcontacts.contact.gender.Gender;
 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
@@ -39,6 +40,13 @@ public interface PizzaContactWebSessionController extends Serializable {
         */
        public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
 
+       /**
+        * Returns a list of all found contacts
+        * <p>
+        * @return A list of all contacts.
+        */
+       List<Contact> allContacts();
+
        /**
         * Updates all data from bean in given contact instance
         * <p>
index 4c52300799453d3c1a40cbc4f7011063ca516f94..dad9d8cc2bc1385c40619ab966c045b4e9d72708 100644 (file)
                        <to-view-id>/admin/user/admin_customer_unlock.xhtml</to-view-id>
                </navigation-case>
        </navigation-rule>
+       <navigation-rule>
+               <from-view-id>/admin/contact/admin_contact_list.xhtml</from-view-id>
+               <navigation-case>
+                       <from-outcome>admin_delete_contact</from-outcome>
+                       <to-view-id>/admin/contact/admin_contact_delete.xhtml</to-view-id>
+               </navigation-case>
+               <navigation-case>
+                       <from-outcome>admin_edit_contact</from-outcome>
+                       <to-view-id>/admin/contact/admin_contact_edit.xhtml</to-view-id>
+               </navigation-case>
+               <navigation-case>
+                       <from-outcome>admin_show_contact</from-outcome>
+                       <to-view-id>/admin/contact/admin_contact_show.xhtml</to-view-id>
+               </navigation-case>
+       </navigation-rule>
        <!--
        <factory>
                <exception-handler-factory>
index 072636b60cf5335325bdf75c193edc68113d7011..751359b964c82b44da99da68591534e187a8ad7a 100644 (file)
@@ -1,4 +1,4 @@
-_<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html
        lang="#{localizationController.language}" xml:lang="#{localizationController.language}"
@@ -16,7 +16,56 @@ _<?xml version="1.0" encoding="UTF-8" ?>
                </ui:define>
 
                <ui:define name="content">
-                       Here goes your content.
+                       <h:dataTable id="table_list_contacts" var="contact" value="#{adminContactController.allContacts()}" styleClass="table_big" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_CONTACT}" rendered="#{adminContactController.hasContacts()}">
+                               <h:column>
+                                       <f:facet name="header">#{msg.ADMIN_LIST_CONTACT_ID}</f:facet>
+
+                                       <h:link outcome="admin_show_contact" title="#{msg.ADMIN_LINK_SHOW_CONTACT_TITLE}" value="#{contact.contactId}">
+                                               <f:param name="contactId" value="#{contact.contactId}" />
+                                       </h:link>
+                               </h:column>
+
+                               <h:column>
+                                       <f:facet name="header">#{msg.ADMIN_LIST_CONTACT_GENDER}</f:facet>
+
+                                       <h:outputText value="#{msg[contact.contactGender.messageKey]}" />
+                               </h:column>
+
+                               <h:column>
+                                       <f:facet name="header">#{msg.ADMIN_LIST_CONTACT_FIRST_NAME}</f:facet>
+
+                                       <h:outputText value="#{contact.contactFirstName}" />
+                               </h:column>
+
+                               <h:column>
+                                       <f:facet name="header">#{msg.ADMIN_LIST_CONTACT_FAMILY_NAME}</f:facet>
+
+                                       <h:outputText value="#{contact.contactFamilyName}" />
+                               </h:column>
+
+                               <h:column>
+                                       <f:facet name="header">#{msg.ADMIN_LIST_CONTACT_CREATED}</f:facet>
+
+                                       <h:outputText id="contactCreated" value="#{contact.contactCreated.time}">
+                                               <f:convertDateTime for="contactCreated" type="both" timeStyle="short" dateStyle="short" />
+                                       </h:outputText>
+                               </h:column>
+                       </h:dataTable>
+
+                       <div class="table_medium">
+                               <h:form id="admin_add_contact">
+                                       <div class="table_header">
+                                               #{msg.ADMIN_ADD_CONTACT_TITLE}
+                                       </div>
+
+                                       <ui:include src="/WEB-INF/templates/admin/contact/admin_form_contact_data.tpl" />
+
+                                       <div class="table_footer">
+                                               <h:commandButton class="reset" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
+                                               <h:commandButton class="submit" type="submit" id="register" value="#{msg.BUTTON_ADMIN_ADD_CONTACT}" action="#{adminContactController.addContact()}" />
+                                       </div>
+                               </h:form>
+                       </div>
                </ui:define>
        </ui:composition>
 </html>
index 1b7cce22433d3da3769722e256dacaa5a68728aa..018692d4f6234159ef9ebbef519534fb3bd63ec5 100644 (file)
@@ -20,7 +20,7 @@
                                <h:column>
                                        <f:facet name="header">#{msg.ADMIN_LIST_CUSTOMER_ID}</f:facet>
 
-                                       <h:link outcome="admin_show_customer" title="#{msg.ADMIN_LINK_SHOW__CUSTOMER_TITLE}" value="#{customer.customerId}">
+                                       <h:link outcome="admin_show_customer" title="#{msg.ADMIN_LINK_SHOW_CUSTOMER_TITLE}" value="#{customer.customerId}">
                                                <f:param name="customerId" value="#{customer.customerId}" />
                                        </h:link>
                                </h:column>