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=09756d8aab9256fb100dcc603cf0870a8d44c7a2;p=jfinancials-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 a7d5ecda..943c684b 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: @@ -1056,6 +1056,7 @@ exists or setup the property manually. For example like this: + @@ -1074,6 +1075,7 @@ exists or setup the property manually. For example like this: + @@ -1386,7 +1388,7 @@ exists or setup the property manually. For example like this: @@ -1425,7 +1427,7 @@ exists or setup the property manually. For example like this: @@ -1461,7 +1463,7 @@ exists or setup the property manually. For example like this: @@ -1483,7 +1485,7 @@ exists or setup the property manually. For example like this: diff --git a/nbproject/faces-config.NavData b/nbproject/faces-config.NavData index 2da090e4..3407e86f 100644 --- a/nbproject/faces-config.NavData +++ b/nbproject/faces-config.NavData @@ -3,68 +3,69 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/project.properties b/nbproject/project.properties index 28469721..7655b264 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -82,7 +82,8 @@ javac.classpath=\ ${reference.addressbook-lib.jar}:\ ${reference.addressbook-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 82c00c24..f5d968e6 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -74,6 +74,10 @@ ${file.reference.gf-client.jar} + + ${libs.primefaces.classpath} + WEB-INF/lib + diff --git a/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java b/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java index cd91f9a2..d912dbbe 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java +++ b/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java @@ -42,6 +42,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; @@ -410,6 +411,46 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro 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/addressbook/beans/contact/AddressbookAdminContactWebRequestController.java b/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestController.java index 17da4a01..4e4a7d89 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestController.java +++ b/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestController.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 AddressbookAdminContactWebRequestController extends Serializabl */ 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/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index 93bc22fb..74ff6927 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -540,3 +540,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 12ab7824..56efcee8 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -537,3 +537,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/web/WEB-INF/faces-config.xml b/web/WEB-INF/faces-config.xml index 89624e7a..a18ce4c7 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 8f7fa3ff..c9de554d 100644 --- a/web/WEB-INF/templates/admin/admin_menu.tpl +++ b/web/WEB-INF/templates/admin/admin_menu.tpl @@ -22,6 +22,15 @@

  • + + +
      +
    • +
    • +
    + diff --git a/web/admin/contact/admin_contact_export.xhtml b/web/admin/contact/admin_contact_export.xhtml new file mode 100644 index 00000000..91b6c58c --- /dev/null +++ b/web/admin/contact/admin_contact_export.xhtml @@ -0,0 +1,165 @@ + + + + + + #{msg.PAGE_TITLE_ADMIN_EXPORT_CONTACT} + + + #{msg.CONTENT_TITLE_ADMIN_EXPORT_CONTACT} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + #{msg.ADMIN_EXPORT_CONTACTS_TITLE} +
    + +
    + +
    + + +
    +
    +
    +
    +