From: Roland Häder Date: Fri, 20 May 2016 10:32:12 +0000 (+0200) Subject: Continued with data export with PrimeFaces: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=942022eccafe54dae0d7038f865ac32fe06676b4;p=pizzaservice-war.git Continued with data export with PrimeFaces: - added prime faces 5.3 to project - added admin_contact_export.xhtml with navigation rule to export contact data (currently only CSV but e.g. Excel is easy to add) - added missing contact i18n and export string - added controller methods generatePhoneNumber() and generateCellphoneNumber(), if e.g. ui:fragment is used, an object id instead of the phone numbers is shown. Maybe a bug in PrimeFaces or wrong usage of ui:fragment? Sometimes a POJO property like contactFaxNumber can be null. Then this needs to be taken care of. Signed-off-by: Roland Häder --- diff --git a/lib/nblibraries.properties b/lib/nblibraries.properties index 6d0afb59..15ca34e3 100644 --- a/lib/nblibraries.properties +++ b/lib/nblibraries.properties @@ -2,3 +2,8 @@ libs.CopyLibs.classpath=\ ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar libs.CopyLibs.displayName=CopyLibs Task libs.CopyLibs.prop-version=2.0 +libs.primefaces.classpath=\ + ${base}/primefaces/primefaces-5.3.jar +libs.primefaces.displayName=PrimeFaces 5.3 +libs.primefaces.prop-maven-dependencies=\n org.primefaces:primefaces:5.3:jar\n +libs.primefaces.prop-maven-repositories=default:http://repository.primefaces.org/ diff --git a/lib/primefaces/primefaces-5.3.jar b/lib/primefaces/primefaces-5.3.jar new file mode 100644 index 00000000..6865631f Binary files /dev/null and b/lib/primefaces/primefaces-5.3.jar differ diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index 587d7bd9..0c251393 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -821,9 +821,9 @@ or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties f The libs.CopyLibs.classpath property is not set up. -This property must point to +This property must point to org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part -of NetBeans IDE installation and is usually located at +of NetBeans IDE installation and is usually located at <netbeans_installation>/java<version>/ant/extra folder. Either open the project in the IDE and make sure CopyLibs library exists or setup the property manually. For example like this: @@ -1036,48 +1036,36 @@ exists or setup the property manually. For example like this: - + - - + + - - - - - - - + - + - - + + - - - - - - - + @@ -1390,7 +1378,7 @@ exists or setup the property manually. For example like this: @@ -1429,7 +1417,7 @@ exists or setup the property manually. For example like this: @@ -1465,7 +1453,7 @@ exists or setup the property manually. For example like this: @@ -1487,11 +1475,12 @@ exists or setup the property manually. For example like this: + diff --git a/nbproject/faces-config.NavData b/nbproject/faces-config.NavData index 28f251cd..2d20ca61 100644 --- a/nbproject/faces-config.NavData +++ b/nbproject/faces-config.NavData @@ -2,80 +2,81 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/project.properties b/nbproject/project.properties index e5414d72..8afb3ae4 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -84,7 +84,8 @@ javac.classpath=\ ${reference.pizzaservice-lib.jar}:\ ${reference.pizzaservice-mailer.jar}:\ ${file.reference.cdi-api.jar}:\ - ${file.reference.gf-client.jar} + ${file.reference.gf-client.jar}:\ + ${libs.primefaces.classpath} # Space-separated list of extra javac options javac.compilerargs=-Xlint:unchecked -Xlint:deprecation javac.debug=true diff --git a/nbproject/project.xml b/nbproject/project.xml index 1c8d235f..a378bc4f 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -7,11 +7,11 @@ 1.6.5 - ${file.reference.jcore-logger-lib.jar} + ${file.reference.jcoreee.jar} WEB-INF/lib - ${file.reference.jcoreee.jar} + ${file.reference.jcore-logger-lib.jar} WEB-INF/lib @@ -22,14 +22,6 @@ ${file.reference.jcountry-lib.jar} WEB-INF/lib - - ${file.reference.jphone-core.jar} - WEB-INF/lib - - - ${file.reference.jphone-lib.jar} - WEB-INF/lib - ${file.reference.jcontacts-core.jar} WEB-INF/lib @@ -39,27 +31,19 @@ WEB-INF/lib - ${file.reference.juser-core.jar} - WEB-INF/lib - - - ${file.reference.juser-lib.jar} - WEB-INF/lib - - - ${file.reference.jcustomer-core.jar} + ${file.reference.jphone-core.jar} WEB-INF/lib - ${file.reference.jcustomer-lib.jar} + ${file.reference.jphone-lib.jar} WEB-INF/lib - ${file.reference.jshop-core.jar} + ${file.reference.juser-core.jar} WEB-INF/lib - ${file.reference.jshop-ee-lib.jar} + ${file.reference.juser-lib.jar} WEB-INF/lib @@ -68,7 +52,6 @@ ${reference.pizzaservice-lib.jar} - WEB-INF/lib ${reference.pizzaservice-mailer.jar} @@ -76,10 +59,12 @@ ${file.reference.cdi-api.jar} - WEB-INF/lib ${file.reference.gf-client.jar} + + + ${libs.primefaces.classpath} WEB-INF/lib @@ -103,6 +88,14 @@ clean jar + + pizzaservice-lib-1 + jar + + jar + clean + jar + pizzaservice-mailer jar diff --git a/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index f5ca82b1..9b7a938b 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -512,3 +512,14 @@ BUTTON_GUEST_CONFIRM_USER_ACCOUNT=Account best\u00e4tigen 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. +ADMIN_CONTACT_COUNTRY_CODE=L\u00e4ndercode: +ADMIN_CONTACT_CELLPHONE_NUMBER=Handynummer: +ADMIN_CONTACT_LANDLINE_NUMBER=Telefonnummer: +ADMIN_CONTACT_FAX_NUMBER=Faxnummer: +PAGE_TITLE_ADMIN_EXPORT_CONTACT=Kontaktdaten exportieren +CONTENT_TITLE_ADMIN_EXPORT_CONTACT=Kontaktdaten exportieren: +ADMIN_EXPORT_CONTACTS_TITLE=Datenexport starten +ADMIN_EXPORT_CONTACTS_TIMEOUT_WARNING=Bei sehr gro\u00dfen Datenmengen kann es eventuell zu Zeit\u00fcberschreitungen kommen. Daher sollten Sie besser seitenweise exportieren. +BUTTON_ADMIN_EXPORT_CONTACTS_CSV=Alle Daten als CSV-Datei exportieren +LINK_ADMIN_EXPORT_CONTACT=Daten exportieren +LINK_ADMIN_EXPORT_CONTACT_TITLE=Kontaktdaten exportieren diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index 2e39a1ce..5bb27e62 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -496,3 +496,15 @@ BUTTON_GUEST_CONFIRM_USER_ACCOUNT=Confirm account 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. +ADMIN_CONTACT_COUNTRY_CODE=Country code: +ADMIN_CONTACT_CELLPHONE_NUMBER=Cellphone number: +ADMIN_CONTACT_LANDLINE_NUMBER=Phone number: +ADMIN_CONTACT_FAX_NUMBER=Fax number: +PAGE_TITLE_ADMIN_EXPORT_CONTACT=Export contact data +CONTENT_TITLE_ADMIN_EXPORT_CONTACT=Export contact data: +ADMIN_EXPORT_CONTACTS_TITLE=Start data export +#Bei sehr gro\u00dfen Datenmengen kann es eventuell zu Zeit\u00fcberschreitungen kommen. Daher sollten Sie besser seitenweise exportieren. +ADMIN_EXPORT_CONTACTS_TIMEOUT_WARNING=Big data amount may lead to timeouts. You should then try to export each page separately. +BUTTON_ADMIN_EXPORT_CONTACTS_CSV=Export all data as CSV file +LINK_ADMIN_EXPORT_CONTACT=Export data +LINK_ADMIN_EXPORT_CONTACT_TITLE=Export contact data diff --git a/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestBean.java index 001a6157..6b3ef417 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestBean.java @@ -40,6 +40,7 @@ import org.mxchange.jcontacts.events.contact.update.AdminContactUpdatedEvent; import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent; import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException; import org.mxchange.jcountry.data.Country; +import org.mxchange.jphone.phonenumbers.DialableNumber; import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber; import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; @@ -472,6 +473,46 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme return "admin_list_contact"; //NOI18N } + @Override + public String generateCellphoneNumber (final DialableCellphoneNumber cellphoneNumber) { + // Is it null? + if (null == cellphoneNumber) { + // Return null + return null; + } + + // Get all data + String number = String.format( + "%s%d%d", //NOI18N + cellphoneNumber.getCellphoneProvider().getProviderCountry().getCountryExternalDialPrefix(), + cellphoneNumber.getCellphoneProvider().getProviderDialPrefix(), + cellphoneNumber.getPhoneNumber() + ); + + // Return it + return number; + } + + @Override + public String generatePhoneNumber (final DialableNumber phoneNumber) { + // Is it null? + if (null == phoneNumber) { + // Return null + return null; + } + + // Generate it + String number = String.format( + "%s%d%d", //NOI18N + phoneNumber.getPhoneCountry().getCountryExternalDialPrefix(), + phoneNumber.getPhoneAreaCode(), + phoneNumber.getPhoneNumber() + ); + + // Return it + return number; + } + @Override @SuppressWarnings ("ReturnOfDateField") public Date getBirthday () { diff --git a/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestController.java b/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestController.java index 8a379d9b..d8612583 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestController.java @@ -21,6 +21,8 @@ import java.util.Date; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.contact.gender.Gender; import org.mxchange.jcountry.data.Country; +import org.mxchange.jphone.phonenumbers.DialableNumber; +import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber; import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; /** @@ -381,4 +383,23 @@ public interface PizzaAdminContactWebRequestController extends Serializable { */ void setZipCode (final Integer zipCode); + /** + * Returns a text respresentation of given phone number or null if not set. + *

+ * @param phoneNumber Phone number + *

+ * @return Text respresentation or null + */ + String generatePhoneNumber (final DialableNumber phoneNumber); + + /** + * Returns a text representation of given cellphone number or null if not + * set. + *

+ * @param cellphoneNumber Cellphone number + *

+ * @return Text respresentation or null + */ + String generateCellphoneNumber (final DialableCellphoneNumber cellphoneNumber); + } diff --git a/web/WEB-INF/faces-config.xml b/web/WEB-INF/faces-config.xml index 15d2d676..dfb51237 100644 --- a/web/WEB-INF/faces-config.xml +++ b/web/WEB-INF/faces-config.xml @@ -79,6 +79,10 @@ admin_list_contact /admin/contact/admin_contact_list.xhtml + + admin_export_contact + /admin/contact/admin_contact_export.xhtml + admin_list_user /admin/user/admin_user_list.xhtml diff --git a/web/WEB-INF/templates/admin/admin_menu.tpl b/web/WEB-INF/templates/admin/admin_menu.tpl index aad3f7b6..35f6b88d 100644 --- a/web/WEB-INF/templates/admin/admin_menu.tpl +++ b/web/WEB-INF/templates/admin/admin_menu.tpl @@ -38,6 +38,7 @@

  • +