From: Roland Haeder Date: Sun, 11 Oct 2015 19:57:34 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e5f709af7011a884d85a777f59f6355396749495;p=addressbook-war.git Continued: - removed jcountry-lib as this is not working - implemented method to get all countries --- diff --git a/lib/jcountry-lib.jar b/lib/jcountry-lib.jar deleted file mode 100644 index 7f61f695..00000000 Binary files a/lib/jcountry-lib.jar and /dev/null differ diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index 3afa43c8..3240e969 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -1034,7 +1034,6 @@ exists or setup the property manually. For example like this: - @@ -1052,7 +1051,6 @@ exists or setup the property manually. For example like this: - diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 61bd5aed..bddbeed8 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -3,6 +3,6 @@ build.xml.script.CRC32=be5f34f7 build.xml.stylesheet.CRC32=651128d4@1.68.1.1 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=b91929ff -nbproject/build-impl.xml.script.CRC32=b3fbd4a7 +nbproject/build-impl.xml.data.CRC32=794ded5f +nbproject/build-impl.xml.script.CRC32=e6d84652 nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1 diff --git a/nbproject/project.properties b/nbproject/project.properties index f0edbd56..73110f8a 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -44,7 +44,6 @@ file.reference.jcore-logger-lib.jar=lib/jcore-logger-lib.jar file.reference.jcore.jar=lib/jcore.jar file.reference.jcoreee.jar=lib/jcoreee.jar file.reference.jcountry-core.jar=lib/jcountry-core.jar -file.reference.jcountry-lib.jar=lib/jcountry-lib.jar file.reference.jphone-core.jar=lib/jphone-core.jar file.reference.juser-core.jar=lib/juser-core.jar file.reference.juser-lib.jar=lib/juser-lib.jar @@ -66,7 +65,6 @@ javac.classpath=\ ${file.reference.jcoreee.jar}:\ ${file.reference.jcore-logger-lib.jar}:\ ${file.reference.jcountry-core.jar}:\ - ${file.reference.jcountry-lib.jar}:\ ${file.reference.jcontacts-core.jar}:\ ${file.reference.jcontacts-business-core.jar}:\ ${file.reference.jcontacts-lib.jar}:\ @@ -122,7 +120,6 @@ source.reference.jcore-logger-lib.jar=../jcore-logger-lib/src/ source.reference.jcore.jar=../jcore/src/ source.reference.jcoreee.jar=../jcoreee/src/ source.reference.jcountry-core.jar=../jcountry-core/src/ -source.reference.jcountry-lib.jar=../jcountry-lib/src/ source.reference.jphone-core.jar=../jphone-core/src/ source.reference.juser-core.jar=../juser-core/src/ source.reference.juser-lib.jar=../juser-lib/src/ diff --git a/nbproject/project.xml b/nbproject/project.xml index a34b45f1..75f2f1bb 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -22,10 +22,6 @@ ${file.reference.jcountry-core.jar} WEB-INF/lib - - ${file.reference.jcountry-lib.jar} - WEB-INF/lib - ${file.reference.jcontacts-core.jar} WEB-INF/lib diff --git a/src/java/org/mxchange/addressbook/beans/country/CountryWebBean.java b/src/java/org/mxchange/addressbook/beans/country/CountryWebBean.java index 158abc05..2657c3bf 100644 --- a/src/java/org/mxchange/addressbook/beans/country/CountryWebBean.java +++ b/src/java/org/mxchange/addressbook/beans/country/CountryWebBean.java @@ -3,23 +3,28 @@ package org.mxchange.addressbook.beans.country; /* * Copyright (C) 2015 Roland Haeder * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . */ - - +import java.util.List; +import javax.annotation.PostConstruct; import javax.enterprise.context.ApplicationScoped; +import javax.faces.view.facelets.FaceletException; import javax.inject.Named; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import org.mxchange.jcountry.data.AddressbookCountrySingletonBeanRemote; import org.mxchange.jcountry.data.Country; /** @@ -36,14 +41,41 @@ public class CountryWebBean implements CountryWebController { */ private static final long serialVersionUID = 176_985_298_681_742_960L; + /** + * Remote country EJB + */ + private AddressbookCountrySingletonBeanRemote countryBean; + + /** + * List of all countries + */ + private List countryList; + /** * Default constructor */ public CountryWebBean () { + // Try this + try { + // Get initial context + Context context = new InitialContext(); + + // Try to lookup the bean + this.countryBean = (AddressbookCountrySingletonBeanRemote) context.lookup("ejb/singleton-country"); + } catch (final NamingException ex) { + // Continue to throw + throw new FaceletException(ex); + } } @Override public Country[] allCountries () { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + // Return "cached" version + return (Country[]) this.countryList.toArray(); + } + + @PostConstruct + public void init () { + this.countryList = this.countryBean.allCountries(); } } diff --git a/src/java/org/mxchange/addressbook/beans/gender/GenderWebBean.java b/src/java/org/mxchange/addressbook/beans/gender/GenderWebBean.java index f35f4603..a315d4a8 100644 --- a/src/java/org/mxchange/addressbook/beans/gender/GenderWebBean.java +++ b/src/java/org/mxchange/addressbook/beans/gender/GenderWebBean.java @@ -51,7 +51,6 @@ public class GenderWebBean implements GenderWebController { @Override public List getSelectableGenders () { // Init array - // TODO Call EJB here? List genders = GenderUtils.selectableGenders(); // Return it