]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Sat, 26 Aug 2017 10:41:21 +0000 (12:41 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 26 Aug 2017 10:42:24 +0000 (12:42 +0200)
- added converter for headquarters data (please rename + fix JNDI)
- added validator for URLs (please rename)
- renamed allowEmptyEmail to allowEmptyValue and used it more as this is generic
- fixed mixture of headquarters and company founder (my mistake)
- added form elements to set company-contact and owning user instance
- added navigation rules for links from business-contact list to sub pages
  (still some missing)
- added missing i18n strings

Signed-off-by: Roland Häder <roland@mxchange.org>
15 files changed:
src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsAdminBusinessDataWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBusinessDataWebSessionBean.java
src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsCompanyEmployeeWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebSessionBean.java
src/java/org/mxchange/jfinancials/converter/business/basicdata/FinancialsBusinessContactConverter.java
src/java/org/mxchange/jfinancials/converter/business/headquarters/FinancialsCompanyHeadquartersConverter.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/validator/emailaddress/FinancialsEmailAddressValidator.java
src/java/org/mxchange/jfinancials/validator/url/FinancialsUrlValidator.java [new file with mode: 0644]
src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
web/WEB-INF/faces-config.xml
web/WEB-INF/templates/admin/business_basic_data/admin_form_business_basic_data.tpl
web/WEB-INF/templates/admin/contact/admin_form_contact_data.tpl
web/WEB-INF/web.xml
web/admin/business_contacts/admin_business_contacts_list.xhtml

index 41f8f424d42802e79d320a07e5260ebce4b60483..78826580d7de0c83d46823e32845535039eeaccb 100644 (file)
@@ -18,16 +18,29 @@ package org.mxchange.jfinancials.beans.business.basicdata;
 
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+import javax.faces.FacesException;
 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.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemote;
+import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
+import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData;
 import org.mxchange.jcontactsbusiness.employee.Employee;
-import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData;
+import org.mxchange.jcontactsbusiness.events.basicdata.added.BusinessBasicDataAddedEvent;
+import org.mxchange.jcontactsbusiness.events.basicdata.added.ObservableBusinessBasicDataAddedEvent;
+import org.mxchange.jcontactsbusiness.exceptions.basicdata.BusinessDataAlreadyAddedException;
+import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jfinancials.beans.BaseFinancialsController;
+import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
+import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
 import org.mxchange.jusercore.model.user.User;
 
 /**
@@ -35,7 +48,7 @@ import org.mxchange.jusercore.model.user.User;
  * <p>
  * @author Roland Häder<roland@mxchange.org>
  */
-@Named ("adminBusinessDataController")
+@Named ("adminCompanyDataController")
 @RequestScoped
 public class FinancialsAdminBusinessDataWebRequestBean extends BaseFinancialsController implements FinancialsAdminBusinessDataWebRequestController {
 
@@ -49,6 +62,13 @@ public class FinancialsAdminBusinessDataWebRequestBean extends BaseFinancialsCon
         */
        private AdminBusinessDataSessionBeanRemote adminBusinessDataBean;
 
+       /**
+        * An event being fired when basic business data has been added
+        */
+       @Inject
+       @Any
+       private Event<ObservableBusinessBasicDataAddedEvent> businessDataAddedEvent;
+
        /**
         * Comments for this company
         */
@@ -64,10 +84,15 @@ public class FinancialsAdminBusinessDataWebRequestBean extends BaseFinancialsCon
         */
        private String companyEmailAddress;
 
+       /**
+        * Company founder
+        */
+       private Employee companyFounder;
+
        /**
         * Head quarter data for this company
         */
-       private HeadQuartersData companyHeadQuarters;
+       private HeadquartersData companyHeadQuarters;
 
        /**
         * Company name
@@ -80,14 +105,14 @@ public class FinancialsAdminBusinessDataWebRequestBean extends BaseFinancialsCon
        private String companyTaxNumber;
 
        /**
-        * Web site URL
+        * Owning user instance (which this company is assigned to)
         */
-       private String companyWebsiteUrl;
+       private User companyUserOwner;
 
        /**
-        * Owning user instance (which this company is assigned to)
+        * Web site URL
         */
-       private User contactCompanyUserOwner;
+       private String companyWebsiteUrl;
 
        /**
         * Area code for fax number
@@ -120,13 +145,105 @@ public class FinancialsAdminBusinessDataWebRequestBean extends BaseFinancialsCon
        private Long landLineNumber;
 
        /**
-        * Constructor
+        * Default constructor
         */
        public FinancialsAdminBusinessDataWebRequestBean () {
                // Call super constructor
                super();
        }
 
+       /**
+        * Adds a basic business data entry, if not yet found.
+        * <p>
+        * @return Redirect outcome
+        */
+       public String addBusinessBasicData () {
+               // First, validate all parameter
+               if (this.getCompanyName() == null) {
+                       // Is null
+                       throw new NullPointerException("this.companyName is null"); //NOI18N
+               } else if (this.getCompanyName().isEmpty()) {
+                       // Is null
+                       throw new IllegalArgumentException("this.companyName is empty"); //NOI18N
+               }
+
+               // Prepare entity
+               BusinessBasicData basicData = new CompanyBasicData(this.getCompanyName());
+
+               // Set all opther remaining data
+               basicData.setCompanyComments(this.getCompanyComments());
+               basicData.setCompanyContactEmployee(this.getCompanyContactEmployee());
+               basicData.setCompanyEmailAddress(this.getCompanyEmailAddress());
+               basicData.setCompanyFounder(this.getCompanyFounder());
+               basicData.setCompanyHeadQuartersData(this.getCompanyHeadQuarters());
+               basicData.setCompanyTaxNumber(this.getCompanyTaxNumber());
+               basicData.setCompanyUserOwner(this.getCompanyUserOwner());
+               basicData.setCompanyWebsiteUrl(this.getCompanyWebsiteUrl());
+
+               // Set logo instance
+               // @TODO basicData.setCompanyLogo();
+               // Generate phone number
+               DialableLandLineNumber landLine = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
+               DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
+
+               // Don't set null or wrong references
+               if ((landLine instanceof DialableLandLineNumber) && (landLine.getPhoneCountry() instanceof Country) && (this.getLandLineAreaCode() != null) && (this.getLandLineNumber() != null) && (this.getLandLineAreaCode() > 0) && (this.getLandLineNumber() > 0)) {
+                       // Now the number must be given
+                       if (landLine.getPhoneAreaCode() == null) {
+                               // Is null
+                               throw new NullPointerException("phone.phoneAreaCode is null"); //NOI18N
+                       } else if (landLine.getPhoneAreaCode() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("phone.phoneAreaCode is zero or below."); //NOI18N
+                       } else if (landLine.getPhoneNumber() == null) {
+                               // Is null
+                               throw new NullPointerException("phone.phoneNumber is null"); //NOI18N
+                       } else if (landLine.getPhoneNumber() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("phone.phoneNumber is zero or below."); //NOI18N
+                       }
+
+                       // Set phone number
+                       basicData.setCompanyLandLineNumber(landLine);
+               }
+
+               // Don't set null or wrong references
+               if ((fax instanceof DialableFaxNumber) && (fax.getPhoneCountry() instanceof Country) && (this.getFaxAreaCode() != null) && (this.getFaxNumber() != null) && (this.getFaxAreaCode() > 0) && (this.getFaxNumber() > 0)) {
+                       // Now the number must be given
+                       if (fax.getPhoneAreaCode() == null) {
+                               // Is null
+                               throw new NullPointerException("fax.phoneAreaCode is null"); //NOI18N
+                       } else if (fax.getPhoneAreaCode() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("fax.phoneAreaCode is zero or below."); //NOI18N
+                       } else if (fax.getPhoneNumber() == null) {
+                               // Is null
+                               throw new NullPointerException("fax.phoneNumber is null"); //NOI18N
+                       } else if (fax.getPhoneNumber() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("fax.phoneNumber is zero or below."); //NOI18N
+                       }
+
+                       // Set fax number
+                       basicData.setCompanyFaxNumber(fax);
+               }
+
+               // Now try to send to EJB and get an updated version back
+               try {
+                       // Try it
+                       BusinessBasicData updatedBasicData = this.adminBusinessDataBean.addCompanyBasicData(basicData);
+
+                       // Fire event
+                       this.businessDataAddedEvent.fire(new BusinessBasicDataAddedEvent(updatedBasicData));
+               } catch (final BusinessDataAlreadyAddedException e) {
+                       // Does already exist
+                       throw new FacesException(e);
+               }
+
+               // Continue to list again
+               return "admin_list_business_contacts"; //NOI18N
+       }
+
        /**
         * Getter for comments
         * <p>
@@ -181,12 +298,30 @@ public class FinancialsAdminBusinessDataWebRequestBean extends BaseFinancialsCon
                this.companyEmailAddress = companyEmailAddress;
        }
 
+       /**
+        * Getter for company founder
+        * <p>
+        * @return Company founder
+        */
+       public Employee getCompanyFounder () {
+               return this.companyFounder;
+       }
+
+       /**
+        * Setter for company founder
+        * <p>
+        * @param companyFounder Company founder
+        */
+       public void setCompanyFounder (final Employee companyFounder) {
+               this.companyFounder = companyFounder;
+       }
+
        /**
         * Getter for headquarters data
         * <p>
         * @return Headquarters data
         */
-       public HeadQuartersData getCompanyHeadQuarters () {
+       public HeadquartersData getCompanyHeadQuarters () {
                return this.companyHeadQuarters;
        }
 
@@ -195,7 +330,7 @@ public class FinancialsAdminBusinessDataWebRequestBean extends BaseFinancialsCon
         * <p>
         * @param companyHeadQuarters Headquarters data
         */
-       public void setCompanyHeadQuarters (final HeadQuartersData companyHeadQuarters) {
+       public void setCompanyHeadQuarters (final HeadquartersData companyHeadQuarters) {
                this.companyHeadQuarters = companyHeadQuarters;
        }
 
@@ -236,39 +371,39 @@ public class FinancialsAdminBusinessDataWebRequestBean extends BaseFinancialsCon
        }
 
        /**
-        * Getter for company web site URL
+        * Getter for owning user instance
         * <p>
-        * @return Company web site URL
+        * @return Owning user instance
         */
-       public String getCompanyWebsiteUrl () {
-               return this.companyWebsiteUrl;
+       public User getCompanyUserOwner () {
+               return this.companyUserOwner;
        }
 
        /**
-        * Getter for company web site URL
+        * Setter for owning user instance
         * <p>
-        * @param companyWebsiteUrl Company web site URL
+        * @param companyUserOwner Owning user instance
         */
-       public void setCompanyWebsiteUrl (final String companyWebsiteUrl) {
-               this.companyWebsiteUrl = companyWebsiteUrl;
+       public void setCompanyUserOwner (final User companyUserOwner) {
+               this.companyUserOwner = companyUserOwner;
        }
 
        /**
-        * Getter for owning user instance
+        * Getter for company web site URL
         * <p>
-        * @return Owning user instance
+        * @return Company web site URL
         */
-       public User getContactCompanyUserOwner () {
-               return this.contactCompanyUserOwner;
+       public String getCompanyWebsiteUrl () {
+               return this.companyWebsiteUrl;
        }
 
        /**
-        * Setter for owning user instance
+        * Getter for company web site URL
         * <p>
-        * @param contactCompanyUserOwner Owning user instance
+        * @param companyWebsiteUrl Company web site URL
         */
-       public void setContactCompanyUserOwner (final User contactCompanyUserOwner) {
-               this.contactCompanyUserOwner = contactCompanyUserOwner;
+       public void setCompanyWebsiteUrl (final String companyWebsiteUrl) {
+               this.companyWebsiteUrl = companyWebsiteUrl;
        }
 
        /**
index 03faeb964a70473ac5fc07b684d412017d2f03f1..1e416c5397ab5bae083ca65cea550a94c0c004c9 100644 (file)
@@ -37,7 +37,7 @@ import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionCo
  * <p>
  * @author Roland Häder<roland@mxchange.org>
  */
-@Named ("businessDataController")
+@Named ("companyDataController")
 @SessionScoped
 public class FinancialsBusinessDataWebSessionBean extends BaseFinancialsController implements FinancialsBusinessDataWebSessionController {
 
@@ -127,7 +127,7 @@ public class FinancialsBusinessDataWebSessionBean extends BaseFinancialsControll
         * @return A list of all business contacts
         */
        @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<BusinessBasicData> allBusinessContacts () {
+       public List<BusinessBasicData> allCompanyBasicData () {
                return this.businessContacts;
        }
 
@@ -314,7 +314,7 @@ public class FinancialsBusinessDataWebSessionBean extends BaseFinancialsControll
                }
 
                // Init user's contact list
-               this.businessContacts = this.adminBusinessDataBean.allBusinessContacts();
+               this.businessContacts = this.adminBusinessDataBean.allCompanyBasicData();
        }
 
 }
index aae159402ea45eea3849c26cad2f1fc41e12f840..5c51226d530572d6945a6471f325a92bb11ac3dc 100644 (file)
@@ -85,7 +85,7 @@ public class FinancialsCompanyEmployeeWebRequestBean extends BaseFinancialsContr
                        Context context = new InitialContext();
 
                        // Try to lookup
-                       this.companyEmployeeBean = (CompanyEmployeeSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/adminCompanyEmployee!org.mxchange.jcontactsbusiness.employee.CompanyEmployeeSessionBeanRemote"); //NOI18N
+                       this.companyEmployeeBean = (CompanyEmployeeSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/companyEmployee!org.mxchange.jcontactsbusiness.employee.CompanyEmployeeSessionBeanRemote"); //NOI18N
                } catch (final NamingException e) {
                        // Throw again
                        throw new FaceletException(e);
index 9bb4c2c90e790e13bc95feb4196ea7e294451d24..3dc1aabf81926bba492a44372fc213964596db16 100644 (file)
@@ -125,12 +125,12 @@ public class FinancialsReceiptWebSessionBean extends BaseFinancialsController im
                } else if (this.getReceiptCompany() == null) {
                        // Is not set
                        throw new NullPointerException("this.receiptCompany is not set."); //NOI18N
-               } else if (this.getReceiptCompany().getBusinessDataId() == null) {
+               } else if (this.getReceiptCompany().getCompanyDataId() == null) {
                        // It must be an already peristed instance
                        throw new NullPointerException("this.receiptCompany.businessContactId is not set."); //NOI18N
-               } else if (this.getReceiptCompany().getBusinessDataId() < 1) {
+               } else if (this.getReceiptCompany().getCompanyDataId() < 1) {
                        // It must be an already peristed instance
-                       throw new IllegalArgumentException(MessageFormat.format("this.receiptCompany.businessContactId={0} is not valid.", this.getReceiptCompany().getBusinessDataId())); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("this.receiptCompany.businessContactId={0} is not valid.", this.getReceiptCompany().getCompanyDataId())); //NOI18N
                } else if (this.getPaymentType() == null) {
                        // Is not set
                        throw new NullPointerException("this.paymentType is not set."); //NOI18N
@@ -144,7 +144,7 @@ public class FinancialsReceiptWebSessionBean extends BaseFinancialsController im
 
                if (this.isReceiptAdded(receipt)) {
                        // Receipt has already been added
-                       throw new FaceletException(MessageFormat.format("Receipt for receiptCompany={0},receiptIssued={1},receiptNumber={2} has already been added.", this.getReceiptCompany().getBusinessDataId(), this.getReceiptIssued().toString(), this.getReceiptNumber())); //NOI18N
+                       throw new FaceletException(MessageFormat.format("Receipt for receiptCompany={0},receiptIssued={1},receiptNumber={2} has already been added.", this.getReceiptCompany().getCompanyDataId(), this.getReceiptIssued().toString(), this.getReceiptNumber())); //NOI18N
                }
 
                // Init variable
index fbc9b6246a87a1f812bffa23ccb33c899033ee2a..27f973d4012bcad033393c8afaba60c02dc93860 100644 (file)
@@ -84,7 +84,7 @@ public class FinancialsBusinessContactConverter implements Converter {
                        Long contactId = Long.valueOf(submittedValue);
 
                        // Try to get user instance from it
-                       businessContact = FinancialsBusinessContactConverter.BUSINESS_CONTACT_BEAN.findBusinessDataById(contactId);
+                       businessContact = FinancialsBusinessContactConverter.BUSINESS_CONTACT_BEAN.findBasicDataById(contactId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
@@ -109,7 +109,7 @@ public class FinancialsBusinessContactConverter implements Converter {
                }
 
                // Return id number
-               return String.valueOf(((BusinessBasicData) value).getBusinessDataId());
+               return String.valueOf(((BusinessBasicData) value).getCompanyDataId());
        }
 
 }
diff --git a/src/java/org/mxchange/jfinancials/converter/business/headquarters/FinancialsCompanyHeadquartersConverter.java b/src/java/org/mxchange/jfinancials/converter/business/headquarters/FinancialsCompanyHeadquartersConverter.java
new file mode 100644 (file)
index 0000000..927584c
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.converter.business.headquarters;
+
+import java.text.MessageFormat;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.convert.FacesConverter;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcontactsbusiness.exceptions.headquarters.CompanyHeadquartersNotFoundException;
+import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadquartersSessionBeanRemote;
+import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData;
+
+/**
+ * Converter for converting company headquarters to and from id number
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@FacesConverter (value = "CompanyHeadquartersConverter")
+public class FinancialsCompanyHeadquartersConverter implements Converter {
+
+       /**
+        * CompanyEmployee EJB
+        */
+       private static CompanyHeadquartersSessionBeanRemote COMPANY_HEADQUARTERS_BEAN;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsCompanyHeadquartersConverter () {
+       }
+
+       @Override
+       public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+               // Is the value null or empty?
+               if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
+                       // Warning message
+                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
+
+                       // Return null
+                       return null;
+               }
+
+               // Is the bean there?
+               // @TODO Requires this synchronization or is it (sync) confusing the container?
+               if (null == FinancialsCompanyHeadquartersConverter.COMPANY_HEADQUARTERS_BEAN) {
+                       // Try to get it
+                       try {
+                               // Get initial context
+                               Context initialContext = new InitialContext();
+
+                               // ... and user controller
+                               FinancialsCompanyHeadquartersConverter.COMPANY_HEADQUARTERS_BEAN = (CompanyHeadquartersSessionBeanRemote) initialContext.lookup("java:global/jfinancials-ejb/companyEmployee!org.mxchange.jcontactsbusiness.headquarters.CompanyHeadquartersSessionBeanRemote"); //NOI18N
+                       } catch (final NamingException ex) {
+                               // Continue to throw it
+                               throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+                       }
+               }
+
+               // Init instance
+               HeadquartersData companyHeadquarters = null;
+
+               try {
+                       // Try to parse the value as long
+                       Long headquartersId = Long.valueOf(submittedValue);
+
+                       // Try to get user instance from it
+                       companyHeadquarters = FinancialsCompanyHeadquartersConverter.COMPANY_HEADQUARTERS_BEAN.findCompanyHeadquartersById(headquartersId);
+               } catch (final NumberFormatException ex) {
+                       // Throw again
+                       throw new ConverterException(ex);
+               } catch (final CompanyHeadquartersNotFoundException ex) {
+                       // Debug message
+                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N
+               }
+
+               // Return it
+               return companyHeadquarters;
+       }
+
+       @Override
+       public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
+               // Is the object null?
+               if ((null == value) || (String.valueOf(value).isEmpty())) {
+                       // Is null
+                       return ""; //NOI18N
+               } else if (!(value instanceof HeadquartersData)) {
+                       // Not same interface
+                       throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement HeadquartersData.", value.getClass().getSimpleName())); //NOI18N
+               }
+
+               // Return id number
+               return String.valueOf(((HeadquartersData) value).getHeadquartersId());
+       }
+
+}
index e3c427d32587f6bcda664aab3aae2c48602fd8c5..5fc6056b9314f81ea57718ebf07c23ea5b7b4cd0 100644 (file)
@@ -44,14 +44,14 @@ public class FinancialsEmailAddressValidator extends BaseStringValidator impleme
        private static ContactSessionBeanRemote CONTACT_BEAN;
 
        /**
-        * Pattern matcher
+        * Email pattern
         */
-       private static final Pattern EMAIL_PATTERN = Pattern.compile(FinancialsEmailAddressValidator.EMAIL_REGEX);
+       private static final String EMAIL_REGEX = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$"; //NOI18N
 
        /**
-        * Email pattern
+        * Pattern matcher
         */
-       private static final String EMAIL_REGEX = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$"; //NOI18N
+       private static final Pattern PATTERN_MATCHER = Pattern.compile(FinancialsEmailAddressValidator.EMAIL_REGEX);
 
        /**
         * Serial number
@@ -66,34 +66,32 @@ public class FinancialsEmailAddressValidator extends BaseStringValidator impleme
 
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
-               System.out.println("validate: value=" + value); //NOI18N
                // The required field
                String[] requiredFields = {"emailAddress", "emailAddressRepeat", "resendEmailAddress"}; //NOI18N
 
                // Default is to reject empty email address fields
-               Boolean allowEmptyEmail = Boolean.FALSE;
+               Boolean allowEmptyValue = Boolean.FALSE;
 
-               // Is attribute "allowEmptyEmail" set?
-               if (component.getAttributes().containsKey("allowEmptyEmail")) { //NOI18N
+               // Is attribute "allowEmptyValue" set?
+               if (component.getAttributes().containsKey("allowEmptyValue")) { //NOI18N
                        // Get attribute
-                       Object attribute = component.getAttributes().get("allowEmptyEmail"); //NOI18N
-                       System.out.println("attribute=" + attribute); //NOI18N
+                       Object attribute = component.getAttributes().get("allowEmptyValue"); //NOI18N
 
                        // Make sure, it is Boolean as no String is accepted anymore
                        if (!(attribute instanceof String)) {
                                // Not valid attribute, please use "true" or "false" (default)
-                               throw new IllegalArgumentException("allowEmptyEmail must be of type String. Please use \"true\" or \"false\" for f:attribute value."); //NOI18N
+                               throw new IllegalArgumentException("allowEmptyValue must be of type String. Please use \"true\" or \"false\" for f:attribute value."); //NOI18N
                        }
 
                        // Securely cast it
-                       allowEmptyEmail = Boolean.parseBoolean((String) attribute);
+                       allowEmptyValue = Boolean.parseBoolean((String) attribute);
                }
 
                // Pre-validation (example: not null, not a string, empty string ...)
-               super.preValidate(context, component, value, requiredFields, allowEmptyEmail);
+               super.preValidate(context, component, value, requiredFields, allowEmptyValue);
 
                // Is the email address empty and allowed?
-               if (null == value && allowEmptyEmail) {
+               if (null == value && allowEmptyValue) {
                        // Then accept this here
                        return;
                } else if (null == value) {
@@ -107,7 +105,7 @@ public class FinancialsEmailAddressValidator extends BaseStringValidator impleme
 
                // Checks if the email address matches a regex ("low-level" check)
                // @TODO Should also be done by <f:validatorRegex />)
-               boolean matches = EMAIL_PATTERN.matcher(emailAddress).matches(); //NOI18N
+               boolean matches = PATTERN_MATCHER.matcher(emailAddress).matches(); //NOI18N
 
                // Is the email address valid?
                if (!matches) {
diff --git a/src/java/org/mxchange/jfinancials/validator/url/FinancialsUrlValidator.java b/src/java/org/mxchange/jfinancials/validator/url/FinancialsUrlValidator.java
new file mode 100644 (file)
index 0000000..9ec2b05
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.validator.url;
+
+import java.text.MessageFormat;
+import java.util.regex.Pattern;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.FacesValidator;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+import org.mxchange.jcoreee.validator.string.BaseStringValidator;
+
+/**
+ * A validator for URL vallidation (only regex, but allow empty value if
+ * allowed).
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@FacesValidator ("UrlValidator")
+public class FinancialsUrlValidator extends BaseStringValidator implements Validator {
+
+       /**
+        * Pattern matcher
+        */
+       private static final Pattern PATTERN_MATCHER = Pattern.compile(FinancialsUrlValidator.URL_REGEX);
+
+       /**
+        * Email pattern
+        */
+       private static final String URL_REGEX = "(http|https):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&amp;:/~\\+#]*[\\w\\-\\@?^=%&amp;/~\\+#])?"; //NOI18N
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 187_536_745_607_193L;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsUrlValidator () {
+       }
+
+       @Override
+       public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
+               // The required field
+               String[] requiredFields = {"companyWebsiteUrl"}; //NOI18N
+
+               // Default is to reject empty email address fields
+               Boolean allowEmptyValue = Boolean.FALSE;
+
+               // Is attribute "allowEmptyValue" set?
+               if (component.getAttributes().containsKey("allowEmptyValue")) { //NOI18N
+                       // Get attribute
+                       Object attribute = component.getAttributes().get("allowEmptyValue"); //NOI18N
+
+                       // Make sure, it is Boolean as no String is accepted anymore
+                       if (!(attribute instanceof String)) {
+                               // Not valid attribute, please use "true" or "false" (default)
+                               throw new IllegalArgumentException("allowEmptyValue must be of type String. Please use \"true\" or \"false\" for f:attribute value."); //NOI18N
+                       }
+
+                       // Securely cast it
+                       allowEmptyValue = Boolean.parseBoolean((String) attribute);
+               }
+
+               // Pre-validation (example: not null, not a string, empty string ...)
+               super.preValidate(context, component, value, requiredFields, allowEmptyValue);
+
+               // Is the email address empty and allowed?
+               if (null == value && allowEmptyValue) {
+                       // Then accept this here
+                       return;
+               } else if (null == value) {
+                       // Abort here
+                       throw new ValidatorException(new FacesMessage("No empty URL allowed.")); //NOI18N
+               }
+
+               // Get string from object ... ;-)
+               String url = String.valueOf(value).trim();
+
+               // Checks if the email address matches a regex ("low-level" check)
+               // @TODO Should also be done by <f:validatorRegex />)
+               boolean matches = PATTERN_MATCHER.matcher(url).matches(); //NOI18N
+
+               // Is the email address valid?
+               if (!matches) {
+                       // Generate message
+                       String message = MessageFormat.format("URL {0} does not match regular expression.", url); //NOI18N
+
+                       // Not matching
+                       throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message));
+               }
+       }
+
+}
index c34ddf7a2165720ad25bdd95cbdd83eb758b20c1..0a390ec590f21447480f4529b0032447f8c396f6 100644 (file)
@@ -835,7 +835,7 @@ ADMIN_BUSINESS_BASIC_DATA_ID=Id-Nummer:
 ADMIN_LINK_SHOW_BUSINESS_CONTACT_DATA_TITLE=Details des geschaeftlichen Kontaktes anzeigen.
 ADMIN_BUSINESS_BASIC_DATA_OWNER_ID=Zugew. Benutzer:
 ADMIN_LINK_SHOW_BUSINESS_BASIC_DATA_OWNER_USER_TITLE=Benutzerprofil des zugewiesenen Benutzers anzeigen.
-ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_OWNER_USER=Zuweisen
+ADMIN_LINK_ASSIGN=Zuweisen
 #@TODO Please fix German umlauts!
 ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_OWNER_USER_TITLE=Geschaeftlichen Kontakt einen Benutzeraccount zuweisen.
 ADMIN_BUSINESS_BASIC_DATA_COMPANY_NAME=Firmenname:
@@ -877,3 +877,17 @@ ADMIN_BUSINESS_DATA_COMPANY_WEBSITE_URL=Webseiten-URL:
 ADMIN_SELECT_BUSINESS_DATA_COMPANY_USER_OWNER=Unternehmen einem Benutzer zuweisen:
 #@TODO Please fix German umlauts!
 ADMIN_SELECT_BUSINESS_DATA_COMPANY_LOGO=Firmenlogo auswaehlen:
+#@TODO Please fix German umlauts!
+URL_NOT_MATCHING_REGULAR_EXPRESSION=Die eingegebene URL entspricht nicht der ueblichen Form.
+#@TODO Please fix German umlauts!
+ADMIN_SELECT_BUSINESS_DATA_COMPANY_CONTACT_EMPLOYEE=Mitarbeiter als Kontaktperson auswaehlen:
+#@TODO Please fix German umlauts!
+ADMIN_SELECT_BUSINESS_DATA_COMPANY_HEADQUARTERS=Daten des Hauptsitzesz auswaehlen:
+LINK_COMPANY_WEBSITE_URL_TITLE=Zur Unternehmenswebseite (neues Fenster) surfen
+#@TODO Please fix German umlauts!
+ADMIN_BUSINESS_BASIC_DATA_COMPANY_FOUNDER=Gruender
+#@TODO Please fix German umlauts!
+ADMIN_LINK_SHOW_BUSINESS_BASIC_DATA_COMPANY_FOUNDER_TITLE=Daten des Unternehmensgruenders anzeigen.
+#@TODO Please fix German umlauts!
+ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_COMPANY_FOUNDER_TITLE=Weisst diesem Firmeneintrag einen Unternehmensgruender zu.
+ADMIN_BUSINESS_BASIC_DATA_CREATED=Eintrag erstellt
index 1937ff54c7eeb13c18ebb10a662a03d77b57c476..024324fcbb3d04c695c0138a8ef1adc3e9152790 100644 (file)
@@ -794,7 +794,7 @@ LOGIN_FINANCIAL_ENTER_RECEIPT_ISSUED_TITLE=Please enter or select here the exact
 GUEST_REGISTRATION_PASSWORD_NOT_ENTERED=Please enter a password. This must match with security rules.
 GUEST_REGISTRATION_PASSWORD_REPEAT_NOT_ENTERED=Please repeat the entered password. This done to confirm the password.
 PAGE_TITLE_ADMIN_AREA=Administration
-ADMIN_MENU_BUSINESS_BASIC_DATA_TITLE=Business Contacts
+ADMIN_MENU_BUSINESS_BASIC_DATA_TITLE=Business contacts
 LINK_ADMIN_LIST_BUSINESS_BASIC_DATA=List business contacts
 LINK_ADMIN_LIST_BUSINESS_BASIC_DATA_TITLE=Lists business contacts
 LINK_ADMIN_EXPORT_BUSINESS_BASIC_DATA=Export business contacts
@@ -807,7 +807,7 @@ ADMIN_BUSINESS_BASIC_DATA_ID=Id Number:
 ADMIN_LINK_SHOW_BUSINESS_CONTACT_DATA_TITLE=Show details of this business contact.
 ADMIN_BUSINESS_BASIC_DATA_OWNER_ID=Assigned user:
 ADMIN_LINK_SHOW_BUSINESS_BASIC_DATA_OWNER_USER_TITLE=Shows assigned user profile.
-ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_OWNER_USER=Assign
+ADMIN_LINK_ASSIGN=Assign
 ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_OWNER_USER_TITLE=Assigns this business contact to a user account.
 ADMIN_BUSINESS_BASIC_DATA_COMPANY_NAME=Company name:
 ADMIN_BUSINESS_BASIC_DATA_CONTACT_PERSON=Contact person:
@@ -840,3 +840,11 @@ ADMIN_BUSINESS_DATA_COMPANY_TAX_NUMBER=Tax number:
 ADMIN_BUSINESS_DATA_COMPANY_WEBSITE_URL=Website URL:
 ADMIN_SELECT_BUSINESS_DATA_COMPANY_USER_OWNER=Select user to assign with company:
 ADMIN_SELECT_BUSINESS_DATA_COMPANY_LOGO=Choose company logo:
+URL_NOT_MATCHING_REGULAR_EXPRESSION=The entered URL does not match the common form.
+ADMIN_SELECT_BUSINESS_DATA_COMPANY_CONTACT_EMPLOYEE=Choose employee as contact person:
+ADMIN_SELECT_BUSINESS_DATA_COMPANY_HEADQUARTERS=Choose headquarters:
+LINK_COMPANY_WEBSITE_URL_TITLE=Surf to company's web site (new window)
+ADMIN_BUSINESS_BASIC_DATA_COMPANY_FOUNDER=Founder
+ADMIN_LINK_SHOW_BUSINESS_BASIC_DATA_COMPANY_FOUNDER_TITLE=Show data of company founder.
+ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_COMPANY_FOUNDER_TITLE=Assigns a company founder to this company entry.
+ADMIN_BUSINESS_BASIC_DATA_CREATED=Entry created
index 8139383a8ad96c81c999eea173c30c524d837a2c..b2bab34b0ad033ffa8269eacf9370092a135d462 100644 (file)
                        <to-view-id>/admin/user/admin_user_show.xhtml</to-view-id>
                </navigation-case>
        </navigation-rule>
+       <navigation-rule>
+               <from-view-id>/admin/business_contacts/admin_business_contacts_list.xhtml</from-view-id>
+               <navigation-case>
+                       <from-outcome>admin_show_business_basic_data</from-outcome>
+                       <to-view-id>/admin/business_contacts/admin_business_contacts_assign.xhtml</to-view-id>
+               </navigation-case>
+               <navigation-case>
+                       <from-outcome>admin_assign_business_basic_data_contact</from-outcome>
+                       <to-view-id>/admin/business_contacts/admin_business_contacts_assign_contact.xhtml</to-view-id>
+               </navigation-case>
+               <navigation-case>
+                       <from-outcome>admin_assign_business_basic_data_founder</from-outcome>
+                       <to-view-id>/admin/business_contacts/admin_business_contacts_assign_founder.xhtml</to-view-id>
+               </navigation-case>
+               <navigation-case>
+                       <from-outcome>admin_assign_business_basic_data_owner</from-outcome>
+                       <to-view-id>/admin/business_contacts/admin_business_contacts_assign_owner.xhtml</to-view-id>
+               </navigation-case>
+       </navigation-rule>
        <!--
        <factory>
                <exception-handler-factory>
index 28542ff6719e290ab420a03419cfa963e22c8a8c..dbff90071f92d7ad7ab78828da8ba76ce6acf4c6 100644 (file)
@@ -17,7 +17,7 @@
                                </div>
 
                                <div class="table_right_medium">
-                                       <h:inputText styleClass="input" id="companyName" size="30" maxlength="200" required="true" requiredMessage="#{msg.ADMIN_BUSINESS_DATA_COMPANY_NAME_REQUIRED}" value="#{adminBusinessDataController.companyName}" />
+                                       <h:inputText styleClass="input" id="companyName" size="30" maxlength="200" required="true" requiredMessage="#{msg.ADMIN_BUSINESS_DATA_COMPANY_NAME_REQUIRED}" value="#{adminCompanyDataController.companyName}" />
                                </div>
                        </h:panelGroup>
 
@@ -31,9 +31,9 @@
                                </div>
 
                                <div class="table_right_medium">
-                                       <h:inputText styleClass="input" id="companyEmailAddress" size="20" maxlength="255" value="#{adminBusinessDataController.companyEmailAddress}" validatorMessage="#{msg.ENTERED_EMAIL_ADDRESS_IS_INVALID}">
+                                       <h:inputText styleClass="input" id="companyEmailAddress" size="20" maxlength="255" value="#{adminCompanyDataController.companyEmailAddress}" validatorMessage="#{msg.ENTERED_EMAIL_ADDRESS_IS_INVALID}">
                                                <f:validator validatorId="EmailAddressValidator" />
-                                               <f:attribute name="allowEmptyEmail" value="true" />
+                                               <f:attribute name="allowEmptyValue" value="true" />
                                        </h:inputText>
                                </div>
                        </h:panelGroup>
@@ -62,7 +62,7 @@
                                </div>
 
                                <div class="table_right_medium">
-                                       <h:inputText styleClass="input" id="companyTaxNumber" size="30" maxlength="200" value="#{adminBusinessDataController.companyTaxNumber}" />
+                                       <h:inputText styleClass="input" id="companyTaxNumber" size="30" maxlength="200" value="#{adminCompanyDataController.companyTaxNumber}" />
                                </div>
                        </h:panelGroup>
 
                                </div>
 
                                <div class="table_right_medium">
-                                       <h:inputText styleClass="input" id="companyWebsiteUrl" size="30" maxlength="200" value="#{adminBusinessDataController.companyWebsiteUrl}" />
+                                       <h:inputText styleClass="input" id="companyWebsiteUrl" size="30" maxlength="200" value="#{adminCompanyDataController.companyWebsiteUrl}" validatorMessage="#{msg.URL_NOT_MATCHING_REGULAR_EXPRESSION}">
+                                               <f:validator validatorId="UrlValidator" />
+                                               <f:attribute name="allowEmptyValue" value="true" />
+                                       </h:inputText>
                                </div>
                        </h:panelGroup>
 
 
                        <h:panelGroup styleClass="table_row" layout="block">
                                <div class="table_left_medium">
-                                       <h:outputLabel for="contactCompanyUserOwner" value="#{msg.ADMIN_SELECT_BUSINESS_DATA_COMPANY_USER_OWNER}" />
+                                       <h:outputLabel for="companyUserOwner" value="#{msg.ADMIN_SELECT_BUSINESS_DATA_COMPANY_USER_OWNER}" />
                                </div>
 
                                <div class="table_right_medium">
-                                       <h:selectOneMenu styleClass="select" id="contactCompanyUserOwner" value="#{adminBusinessDataController.contactCompanyUserOwner}">
+                                       <h:selectOneMenu styleClass="select" id="companyUserOwner" value="#{adminCompanyDataController.companyUserOwner}">
                                                <f:converter converterId="UserConverter" />
                                                <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
                                                <f:selectItems value="#{userController.allUsers()}" var="companyUserOwner" itemValue="#{companyUserOwner}" itemLabel="#{companyUserOwner.userContact.contactFirstName} #{companyUserOwner.userContact.contactFamilyName} (#{companyUserOwner.userName})" />
                        </h:panelGroup>
 
                        <h:panelGroup styleClass="error_container" layout="block">
-                               <h:message for="contactCompanyUserOwner" errorClass="errors" warnClass="warnings" fatalClass="errors" />
+                               <h:message for="companyUserOwner" errorClass="errors" warnClass="warnings" fatalClass="errors" />
+                       </h:panelGroup>
+
+                       <h:panelGroup styleClass="table_row" layout="block">
+                               <div class="table_left_medium">
+                                       <h:outputLabel for="companyContactEmployee" value="#{msg.ADMIN_SELECT_BUSINESS_DATA_COMPANY_CONTACT_EMPLOYEE}" />
+                               </div>
+
+                               <div class="table_right_medium">
+                                       <h:selectOneMenu styleClass="select" id="companyContactEmployee" value="#{adminCompanyDataController.companyContactEmployee}">
+                                               <f:converter converterId="CompanyEmployeeConverter" />
+                                               <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
+                                               <f:selectItems value="#{companyEmployeeController.allCompanyEmployees()}" var="companyHeadQuarters" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
+                                       </h:selectOneMenu>
+                               </div>
+                       </h:panelGroup>
+
+                       <h:panelGroup styleClass="error_container" layout="block">
+                               <h:message for="companyContactEmployee" errorClass="errors" warnClass="warnings" fatalClass="errors" />
                        </h:panelGroup>
 
                        <h:panelGroup styleClass="table_row" layout="block">
                                <div class="table_left_medium">
-                                       <h:outputLabel for="companyHeadQuarters" value="#{msg.ADMIN_SELECT_BUSINESS_DATA_COMPANY_FOUNDER}" />
+                                       <h:outputLabel for="companyFounder" value="#{msg.ADMIN_SELECT_BUSINESS_DATA_COMPANY_FOUNDER}" />
                                </div>
 
                                <div class="table_right_medium">
-                                       <h:selectOneMenu styleClass="select" id="companyHeadQuarters" value="#{adminBusinessDataController.companyHeadQuarters}">
+                                       <h:selectOneMenu styleClass="select" id="companyFounder" value="#{adminCompanyDataController.companyFounder}">
                                                <f:converter converterId="CompanyEmployeeConverter" />
                                                <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
+                                               <f:selectItems value="#{companyEmployeeController.allCompanyEmployees()}" var="companyHeadQuarters" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
+                                       </h:selectOneMenu>
+                               </div>
+                       </h:panelGroup>
+
+                       <h:panelGroup styleClass="error_container" layout="block">
+                               <h:message for="companyFounder" errorClass="errors" warnClass="warnings" fatalClass="errors" />
+                       </h:panelGroup>
+
+                       <h:panelGroup styleClass="table_row" layout="block">
+                               <div class="table_left_medium">
+                                       <h:outputLabel for="companyHeadQuarters" value="#{msg.ADMIN_SELECT_BUSINESS_DATA_COMPANY_HEADQUARTERS}" />
+                               </div>
+
+                               <div class="table_right_medium">
+                                       <h:selectOneMenu styleClass="select" id="companyHeadQuarters" value="#{adminCompanyDataController.companyHeadQuarters}">
+                                               <f:converter converterId="CompanyHeadquartersConverter" />
+                                               <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
                                                <f:selectItems value="#{companyHeadquartersController.allCompanyHeadquarters()}" var="companyHeadQuarters" itemValue="#{companyHeadQuarters}" itemLabel="#{companyHeadQuarters.foo}" />
                                        </h:selectOneMenu>
                                </div>
                                </div>
 
                                <div class="table_right_medium">
-                                       <h:selectOneMenu styleClass="select right_space" id="landLineCountryCode" value="#{adminBusinessDataController.landLineCountry}">
+                                       <h:selectOneMenu styleClass="select right_space" id="landLineCountryCode" value="#{adminCompanyDataController.landLineCountry}">
                                                <f:converter converterId="CountryConverter" />
                                                <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
                                                <f:selectItems value="#{countryController.allCountries()}" var="country" itemValue="#{country}" itemLabel="#{country.countryAbroadDialPrefix}#{country.countryPhoneCode}" />
                                        </h:selectOneMenu>
 
-                                       <h:inputText styleClass="input right_space" id="landLineAreaCode" size="5" maxlength="10" value="#{adminBusinessDataController.landLineAreaCode}">
+                                       <h:inputText styleClass="input right_space" id="landLineAreaCode" size="5" maxlength="10" value="#{adminCompanyDataController.landLineAreaCode}">
                                                <f:validator for="landLineAreaCode" validatorId="PhoneNumberValidator" />
                                        </h:inputText>
 
-                                       <h:inputText styleClass="input" id="landLineNumber" size="10" maxlength="20" value="#{adminBusinessDataController.landLineNumber}">
+                                       <h:inputText styleClass="input" id="landLineNumber" size="10" maxlength="20" value="#{adminCompanyDataController.landLineNumber}">
                                                <f:validator for="landLineNumber" validatorId="PhoneNumberValidator" />
                                        </h:inputText>
                                </div>
                                </div>
 
                                <div class="table_right_medium">
-                                       <h:selectOneMenu styleClass="select right_space" id="faxCountryCode" value="#{adminBusinessDataController.faxCountry}">
+                                       <h:selectOneMenu styleClass="select right_space" id="faxCountryCode" value="#{adminCompanyDataController.faxCountry}">
                                                <f:converter converterId="CountryConverter" />
                                                <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
                                                <f:selectItems value="#{countryController.allCountries()}" var="country" itemValue="#{country}" itemLabel="#{country.countryAbroadDialPrefix}#{country.countryPhoneCode}" />
                                        </h:selectOneMenu>
 
-                                       <h:inputText styleClass="input right_space" id="faxAreaCode" size="5" maxlength="10" value="#{adminBusinessDataController.faxAreaCode}">
+                                       <h:inputText styleClass="input right_space" id="faxAreaCode" size="5" maxlength="10" value="#{adminCompanyDataController.faxAreaCode}">
                                                <f:validator for="faxAreaCode" validatorId="PhoneNumberValidator" />
                                        </h:inputText>
 
-                                       <h:inputText styleClass="input" id="faxNumber" size="10" maxlength="20" value="#{adminBusinessDataController.faxNumber}">
+                                       <h:inputText styleClass="input" id="faxNumber" size="10" maxlength="20" value="#{adminCompanyDataController.faxNumber}">
                                                <f:validator for="faxNumber" validatorId="PhoneNumberValidator" />
                                        </h:inputText>
                                </div>
                                </div>
 
                                <div class="table_right_medium">
-                                       <h:inputTextarea styleClass="input" id="companyComments" rows="7" cols="25" value="#{adminBusinessDataController.companyComments}" />
+                                       <h:inputTextarea styleClass="input" id="companyComments" rows="7" cols="25" value="#{adminCompanyDataController.companyComments}" />
                                </div>
                        </h:panelGroup>
                </fieldset>
index f9c13e4d6649950372fa08a5b3a9a00bcd40cbb8..6b86ed4982a01bbb118aef7dea9585966279c161 100644 (file)
                                <div class="table_right_medium">
                                        <h:inputText styleClass="input" id="emailAddress" size="10" maxlength="255" value="#{adminContactController.emailAddress}" validatorMessage="#{msg.ENTERED_EMAIL_ADDRESS_IS_INVALID}">
                                                <f:validator validatorId="EmailAddressValidator" />
-                                               <f:attribute name="allowEmptyEmail" value="#{allowEmptyRequiredData}" rendered="#{not empty allowEmptyRequiredData}" />
+                                               <f:attribute name="allowEmptyValue" value="#{allowEmptyRequiredData}" rendered="#{not empty allowEmptyRequiredData}" />
                                        </h:inputText>
                                </div>
                        </h:panelGroup>
index eef84030ede3ab14d408180b23212db09c991f83..00caea41cfa1e5fe77f45abaa3c73a2bbae1f04e 100644 (file)
@@ -2,6 +2,11 @@
 <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
     <description>An application to handle all your receipts and do some calculation with it.</description>
     <display-name>JFinancials Application v1.0</display-name>
+    <context-param>
+        <description>Development mode for WELD, keep disabled unless really needed. Currently it messes up the website.</description>
+        <param-name>org.jboss.weld.development</param-name>
+        <param-value>false</param-value>
+    </context-param>
     <context-param>
         <description>Generic custom JSF tags library</description>
         <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
index e63fc10d602e72d44c8618d05a54750a15ff8a76..51f5e9c8e222a432daaf300221b9b0e54121c905 100644 (file)
        </ui:define>
 
        <ui:define name="content">
-               <widgets:outputMessageBox message="#{msg.ADMIN_BUSINESS_BASIC_DATA_LIST_EMPTY}" styleClass="errors" rendered="#{businessDataController.allBusinessContacts().isEmpty()}" />
+               <widgets:outputMessageBox message="#{msg.ADMIN_BUSINESS_BASIC_DATA_LIST_EMPTY}" styleClass="errors" rendered="#{companyDataController.allCompanyBasicData().isEmpty()}" />
 
-               <h:dataTable id="table_list_business_contacts" var="businessContact" value="#{businessDataController.allBusinessContacts()}" styleClass="table_full" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_BUSINESS_BASIC_DATA}" rendered="#{not businessDataController.allBusinessContacts().isEmpty()}">
+               <h:dataTable id="table_list_business_contacts" var="companyData" value="#{companyDataController.allCompanyBasicData()}" styleClass="table_full" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_BUSINESS_BASIC_DATA}" rendered="#{not companyDataController.allCompanyBasicData().isEmpty()}">
                        <h:column>
                                <f:facet name="header">
                                        <h:outputText value="#{msg.ADMIN_BUSINESS_BASIC_DATA_ID}" />
                                </f:facet>
 
-                               <h:link outcome="admin_show_business_basic_data" title="#{msg.ADMIN_LINK_SHOW_BUSINESS_CONTACT_DATA_TITLE}" value="#{businessContact.businessDataId}">
-                                       <f:param name="businessDataId" value="#{businessContact.businessDataId}" />
+                               <h:link outcome="admin_show_business_basic_data" title="#{msg.ADMIN_LINK_SHOW_BUSINESS_CONTACT_DATA_TITLE}" value="#{companyData.companyDataId}">
+                                       <f:param name="companyDataId" value="#{companyData.companyDataId}" />
                                </h:link>
                        </h:column>
 
                                        <h:outputText value="#{msg.ADMIN_BUSINESS_BASIC_DATA_OWNER_ID}" />
                                </f:facet>
 
-                               <h:link outcome="admin_show_user" title="#{msg.ADMIN_LINK_SHOW_BUSINESS_BASIC_DATA_OWNER_USER_TITLE}" value="#{businessContact.contactCompanyUserOwner.userId}" rendered="#{not empty businessContact.contactCompanyUserOwner}" />
+                               <h:link outcome="admin_show_user" title="#{msg.ADMIN_LINK_SHOW_BUSINESS_BASIC_DATA_OWNER_USER_TITLE}" value="#{companyData.companyUserOwner.userId}" rendered="#{not empty companyData.companyUserOwner}">
+                                       <f:param name="userId" value="#{companyData.companyUserOwner.userId}" />
+                               </h:link>
 
-                               <h:link outcome="admin_assign_business_basic_data_owner" title="#{msg.ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_OWNER_USER_TITLE}" value="#{msg[ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_OWNER_USER]}" rendered="#{empty businessContact.contactCompanyUserOwner}" />
+                               <h:link outcome="admin_assign_business_basic_data_owner" title="#{msg.ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_OWNER_USER_TITLE}" value="#{msg.ADMIN_LINK_ASSIGN}" rendered="#{empty companyData.companyUserOwner}">
+                                       <f:param name="companyDataId" value="#{companyData.companyDataId}" />
+                               </h:link>
                        </h:column>
 
                        <h:column>
@@ -43,7 +47,9 @@
                                        <h:outputText value="#{msg.ADMIN_BUSINESS_BASIC_DATA_COMPANY_NAME}" />
                                </f:facet>
 
-                               <h:outputText value="#{businessContact.companyName}" />
+                               <h:outputLink value="#{companyData.companyWebsiteUrl}" target="_blank" title="#{msg.LINK_COMPANY_WEBSITE_URL_TITLE}">
+                                       <h:outputText value="#{companyData.companyName}" />
+                               </h:outputLink>
                        </h:column>
 
                        <h:column>
                                        <h:outputText value="#{msg.ADMIN_BUSINESS_BASIC_DATA_CONTACT_PERSON}" />
                                </f:facet>
 
-                               <h:link outcome="admin_show_business_employee" title="#{msg.ADMIN_LINK_SHOW_BUSINESS_BASIC_DATA_CONTACT_PERSON_TITLE}" value="#{businessContact.companyContactEmployee.employeeId}" rendered="#{not empty businessContact.companyContactEmployee}" />
+                               <h:link outcome="admin_show_business_employee" title="#{msg.ADMIN_LINK_SHOW_BUSINESS_BASIC_DATA_CONTACT_PERSON_TITLE}" value="#{companyData.companyContactEmployee.employeeId}" rendered="#{not empty companyData.companyContactEmployee}">
+                                       <f:param name="employeeId" value="#{companyData.companyContactEmployee.employeeId}" />
+                               </h:link>
 
-                               <h:link outcome="admin_assign_business_basic_data_contact" title="#{msg.ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_CONTACT_PERSON_TITLE}" value="#{msg[ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_CONTACT_PERSON]}" rendered="#{empty businessContact.companyContactEmployee}" />
+                               <h:link outcome="admin_assign_business_basic_data_contact" title="#{msg.ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_CONTACT_PERSON_TITLE}" value="#{msg.ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_CONTACT_PERSON}" rendered="#{empty companyData.companyContactEmployee}">
+                                       <f:param name="companyDataId" value="#{companyData.companyDataId}" />
+                               </h:link>
+                       </h:column>
+
+                       <h:column>
+                               <f:facet name="header">
+                                       <h:outputText value="#{msg.ADMIN_BUSINESS_BASIC_DATA_COMPANY_FOUNDER}" />
+                               </f:facet>
+
+                               <h:link outcome="admin_show_business_employee" title="#{msg.ADMIN_LINK_SHOW_BUSINESS_BASIC_DATA_COMPANY_FOUNDER_TITLE}" value="#{companyData.companyFounder.employeeId}" rendered="#{not empty companyData.companyFounder}">
+                                       <f:param name="employeeId" value="#{companyData.companyFounder.employeeId}" />
+                               </h:link>
+
+                               <h:link outcome="admin_assign_business_basic_data_contact" title="#{msg.ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_COMPANY_FOUNDER_TITLE}" value="#{msg.ADMIN_LINK_ASSIGN}" rendered="#{empty companyData.companyFounder}">
+                                       <f:param name="companyDataId" value="#{companyData.companyDataId}" />
+                               </h:link>
                        </h:column>
 
                        <h:column>
@@ -61,7 +85,7 @@
                                        <h:outputText value="#{msg.ADMIN_BUSINESS_BASIC_DATA_CREATED}" />
                                </f:facet>
 
-                               <h:outputText id="contactCreated" value="#{businessContact.contactCreated.time}">
+                               <h:outputText id="contactCreated" value="#{companyData.companyCreated.time}">
                                        <f:convertDateTime for="contactCreated" type="both" timeStyle="short" dateStyle="short" />
                                </h:outputText>
                        </h:column>
 
                                <div class="table_footer">
                                        <h:commandButton styleClass="reset right_space" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
-                                       <h:commandButton styleClass="submit" type="submit" id="add_business_basic_data" value="#{msg.BUTTON_ADMIN_CONTINUE_BUSINESS_CONTACT_PERSON}" action="#{adminBusinessDataController.addBusinessBasicData()}" />
+                                       <h:commandButton styleClass="submit" type="submit" id="add_business_basic_data" value="#{msg.BUTTON_ADMIN_CONTINUE_BUSINESS_CONTACT_PERSON}" action="#{adminCompanyDataController.addBusinessBasicData()}" />
                                </div>
                        </h:panelGroup>
                </h:form>