/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
+ * Copyright (C) 2016 - 2022 Free Software Foundation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
*/
private String companyName;
+ /**
+ * Company's road number
+ */
+ private String companyRoadNumber;
+
/**
* Company short name
*/
basicData.setCompanyFounder(this.getCompanyFounder());
basicData.setCompanyHeadquarterData(this.getCompanyHeadQuarter());
basicData.setCompanyName(this.getCompanyName());
+ basicData.setCompanyRoadNumber(this.getCompanyRoadNumber());
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());
+ // Init varibables
+ DialableLandLineNumber landLine = null;
+ DialableFaxNumber fax = null;
+
+ // Are all 3 fields set?
+ if (this.getLandLineAreaCode() != null && this.getLandLineCountry() instanceof Country && this.getLandLineNumber() != null) {
+ // Initialize land number number instance
+ landLine = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
+ }
+
+ // Are all 3 fields set?
+ if (this.getFaxAreaCode() != null && this.getFaxCountry() instanceof Country && this.getFaxNumber() != null) {
+ // Initialzie fax number instance
+ 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)) {
basicData.setCompanyFaxNumber(fax);
}
+ // Init variable
+ final BasicData updatedBasicData;
+
// Now try to send to EJB and get an updated version back
try {
// Try it
- final BasicData updatedBasicData = this.adminBasicCompanyDataBean.addBusinessBasicData(basicData);
-
- // Fire event
- this.businessDataAddedEvent.fire(new AdminAddedBusinessBasicDataEvent(updatedBasicData));
+ updatedBasicData = this.adminBasicCompanyDataBean.addBusinessBasicData(basicData);
} catch (final BasicDataAlreadyAddedException e) {
// Does already exist
throw new FacesException(e);
}
+
+ // Fire event
+ this.businessDataAddedEvent.fire(new AdminAddedBusinessBasicDataEvent(updatedBasicData));
}
/**
this.companyName = companyName;
}
+ /**
+ * Getter for company's road number
+ * <p>
+ * @return Company's road number
+ */
+ public String getCompanyRoadNumber () {
+ return this.companyRoadNumber;
+ }
+
+ /**
+ * Setter for company's road number
+ * <p>
+ * @param companyRoadNumber Company's road number
+ */
+ public void setCompanyRoadNumber (final String companyRoadNumber) {
+ this.companyRoadNumber = companyRoadNumber;
+ }
+
/**
* Getter for company short name
* <p>