import javax.inject.Named;
import org.mxchange.jcontactsbusiness.events.basicdata.added.AdminAddedBusinessBasicDataEvent;
import org.mxchange.jcontactsbusiness.events.basicdata.added.ObservableAdminAddedBusinessBasicDataEvent;
-import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicCompanyDataAlreadyAddedException;
+import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataAlreadyAddedException;
import org.mxchange.jcontactsbusiness.model.basicdata.AdminBasicCompanyDataSessionBeanRemote;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
-import org.mxchange.jcontactsbusiness.model.basicdata.CompanyBasicData;
-import org.mxchange.jcontactsbusiness.model.employee.Employee;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData;
import org.mxchange.jcountry.model.data.Country;
import org.mxchange.jjobs.beans.BaseJobsBean;
/**
* An employee as contact person with this company
*/
- private Employee companyContactEmployee;
+ private Employable companyContactEmployee;
/**
* Companies (main) email address (example: info@company.example)
/**
* Company founder
*/
- private Employee companyFounder;
+ private Employable companyFounder;
/**
* Head quarter data for this company
}
// Prepare entity
- BusinessBasicData basicData = new CompanyBasicData(this.getCompanyName());
+ BasicData basicData = new BusinessBasicData(this.getCompanyName());
// Set all opther remaining data
basicData.setCompanyComments(this.getCompanyComments());
// Now try to send to EJB and get an updated version back
try {
// Try it
- BusinessBasicData updatedBasicData = this.adminBasicCompanyDataBean.addCompanyBasicData(basicData);
+ final BasicData updatedBasicData = this.adminBasicCompanyDataBean.addBusinessBasicData(basicData);
// Fire event
this.businessDataAddedEvent.fire(new AdminAddedBusinessBasicDataEvent(updatedBasicData));
- } catch (final BasicCompanyDataAlreadyAddedException e) {
+ } catch (final BasicDataAlreadyAddedException e) {
// Does already exist
throw new FacesException(e);
}
/**
* Getter for employee as contact person
* <p>
- * @return Employee as contact person
+ * @return Employable as contact person
*/
- public Employee getCompanyContactEmployee () {
+ public Employable getCompanyContactEmployee () {
return this.companyContactEmployee;
}
/**
* Setter for employee as contact person
* <p>
- * @param companyContactEmployee Employee as contact person
+ * @param companyContactEmployee Employable as contact person
*/
- public void setCompanyContactEmployee (final Employee companyContactEmployee) {
+ public void setCompanyContactEmployee (final Employable companyContactEmployee) {
this.companyContactEmployee = companyContactEmployee;
}
* <p>
* @return Company founder
*/
- public Employee getCompanyFounder () {
+ public Employable getCompanyFounder () {
return this.companyFounder;
}
* <p>
* @param companyFounder Company founder
*/
- public void setCompanyFounder (final Employee companyFounder) {
+ public void setCompanyFounder (final Employable companyFounder) {
this.companyFounder = companyFounder;
}
import javax.inject.Inject;
import javax.inject.Named;
import org.mxchange.jcontactsbusiness.events.basicdata.added.ObservableAdminAddedBusinessBasicDataEvent;
+import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataNotFoundException;
import org.mxchange.jcontactsbusiness.model.basicdata.AdminBasicCompanyDataSessionBeanRemote;
import org.mxchange.jcontactsbusiness.model.basicdata.BasicCompanyDataSessionBeanRemote;
-import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
import org.mxchange.jcountry.model.data.Country;
import org.mxchange.jjobs.beans.BaseJobsBean;
import org.mxchange.jjobs.beans.user.login.JobsUserLoginWebSessionController;
/**
* List of all basic company data
*/
- private List<BusinessBasicData> allCompanyBasicData;
+ private List<BasicData> allBasicData;
/**
* A list of all registered companies (globally)
*/
@Inject
@NamedCache (cacheName = "basicDataCache")
- private Cache<Long, BusinessBasicData> basicDataCache;
+ private Cache<Long, BasicData> basicDataCache;
/**
* EJB for general basic business data purposes
/**
* List of filtered basic company data
*/
- private List<BusinessBasicData> filteredBasicCompanyData;
+ private List<BasicData> filteredBasicCompanyData;
/**
* Area code for land-line number
super();
// Init list
- this.allCompanyBasicData = new LinkedList<>();
+ this.allBasicData = new LinkedList<>();
}
/**
// Add it to list
this.basicDataCache.put(event.getBasicData().getBasicDataId(), event.getBasicData());
- this.allCompanyBasicData.add(event.getBasicData());
+ this.allBasicData.add(event.getBasicData());
}
/**
* @return A list of all business contacts
*/
@SuppressWarnings ("ReturnOfCollectionOrArrayField")
- public List<BusinessBasicData> allCompanyBasicData () {
- return this.allCompanyBasicData;
+ public List<BasicData> allBasicData () {
+ return this.allBasicData;
+ }
+
+ @Override
+ public BasicData findBasicDataById (final Long basicDataId) throws BasicDataNotFoundException {
+ // Validate parameter
+ if (null == basicDataId) {
+ // Throw NPE
+ throw new NullPointerException("basicDataId is null"); //NOI18N
+ } else if (basicDataId < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException("basicDataId=" + basicDataId + " is invalid"); //NOI18N
+ } else if (!this.basicDataCache.containsKey(basicDataId)) {
+ // Not found
+ throw new BasicDataNotFoundException(basicDataId);
+ }
+
+ // Get it from cache
+ final BasicData basicData = this.basicDataCache.get(basicDataId);
+
+ // Return it
+ return basicData;
}
/**
* @return Filtered basic company data
*/
@SuppressWarnings ("ReturnOfCollectionOrArrayField")
- public List<BusinessBasicData> getFilteredBasicCompanyData () {
+ public List<BasicData> getFilteredBasicCompanyData () {
return this.filteredBasicCompanyData;
}
* @param filteredBasicCompanyData Filtered basic company data
*/
@SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
- public void setFilteredBasicCompanyData (final List<BusinessBasicData> filteredBasicCompanyData) {
+ public void setFilteredBasicCompanyData (final List<BasicData> filteredBasicCompanyData) {
this.filteredBasicCompanyData = filteredBasicCompanyData;
}
// Is cache there?
if (!this.basicDataCache.iterator().hasNext()) {
// Get whole list
- final List<BusinessBasicData> basicDatas = this.businessDataBean.allCompanyBasicData();
+ final List<BasicData> basicDatas = this.businessDataBean.allBusinessBasicData();
// Add all
- for (final BusinessBasicData basicData : basicDatas) {
+ for (final BasicData basicData : basicDatas) {
// Add it to cache
this.basicDataCache.put(basicData.getBasicDataId(), basicData);
}
}
// Is cache there and list is not full?
- if ((this.allCompanyBasicData.isEmpty()) && (this.basicDataCache.iterator().hasNext())) {
+ if ((this.allBasicData.isEmpty()) && (this.basicDataCache.iterator().hasNext())) {
// Get iterator
- final Iterator<Cache.Entry<Long, BusinessBasicData>> iterator = this.basicDataCache.iterator();
+ final Iterator<Cache.Entry<Long, BasicData>> iterator = this.basicDataCache.iterator();
// Build up list
while (iterator.hasNext()) {
// GEt next element
- final Cache.Entry<Long, BusinessBasicData> next = iterator.next();
+ final Cache.Entry<Long, BasicData> next = iterator.next();
// Add to list
- this.allCompanyBasicData.add(next.getValue());
+ this.allBasicData.add(next.getValue());
}
// Sort list
- this.allCompanyBasicData.sort(new Comparator<BusinessBasicData>() {
+ this.allBasicData.sort(new Comparator<BasicData>() {
@Override
- public int compare (final BusinessBasicData o1, final BusinessBasicData o2) {
+ public int compare (final BasicData o1, final BasicData o2) {
return o1.getBasicDataId() > o2.getBasicDataId() ? 1 : o1.getBasicDataId() < o2.getBasicDataId() ? -1 : 0;
}
});
}
}
+ @Override
+ public Boolean isCompanyNameUsed (String companyName) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
/**
* Clears this bean
*/
package org.mxchange.jjobs.beans.business.basicdata;
import java.io.Serializable;
+import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataNotFoundException;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
/**
* An interface for session-scoped basic data controller
*/
public interface JobsBusinessDataWebRequestController extends Serializable {
+ /**
+ * Retrieves a single business data entity for given id number or throws a
+ * proper exception if not found.
+ * <p>
+ * @param basicDataId Company basic data id to lookup
+ * <p>
+ * @return Business contact instance
+ * <p>
+ * @throws BasicDataNotFoundException If the id number could not be
+ * looked up and solved into an entity
+ */
+ BasicData findBasicDataById (final Long basicDataId) throws BasicDataNotFoundException;
+
+ /**
+ * Checks whether given company name already exists
+ * <p>
+ * @param companyName Company name to check
+ * <p>
+ * @return Whether the company name exists
+ */
+ Boolean isCompanyNameUsed (final String companyName);
+
}
import org.mxchange.jcontactsbusiness.events.branchoffice.added.BranchOfficeAddedEvent;
import org.mxchange.jcontactsbusiness.events.branchoffice.added.ObservableBranchOfficeAddedEvent;
import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeAlreadyAddedException;
-import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
import org.mxchange.jcontactsbusiness.model.branchoffice.AdminBranchOfficeSessionBeanRemote;
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffices;
-import org.mxchange.jcontactsbusiness.model.branchoffice.CompanyBranchOffice;
-import org.mxchange.jcontactsbusiness.model.employee.Employee;
+import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice;
import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
import org.mxchange.jcontactsbusiness.model.opening_time.dayofweek.DayOfTheWeek;
import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber;
import org.mxchange.jusercore.model.user.User;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
/**
* An administrative bean for branch offices
/**
* Assigned company for this branch office
*/
- private BusinessBasicData branchCompany;
+ private BasicData branchCompany;
/**
* Contact person in branch office
*/
- private Employee branchContactEmployee;
+ private Employable branchContactEmployee;
/**
* Country
* <p>
* @return Basic company data
*/
- public BusinessBasicData getBranchCompany () {
+ public BasicData getBranchCompany () {
return this.branchCompany;
}
* <p>
* @param branchCompany Basic company data
*/
- public void setBranchCompany (final BusinessBasicData branchCompany) {
+ public void setBranchCompany (final BasicData branchCompany) {
this.branchCompany = branchCompany;
}
* <p>
* @return Branch office contact person
*/
- public Employee getBranchContactEmployee () {
+ public Employable getBranchContactEmployee () {
return this.branchContactEmployee;
}
* <p>
* @param branchContactEmployee Branch office contact person
*/
- public void setBranchContactEmployee (final Employee branchContactEmployee) {
+ public void setBranchContactEmployee (final Employable branchContactEmployee) {
this.branchContactEmployee = branchContactEmployee;
}
*/
@SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
public void setBranchOpeningTimes (final List<OpeningTime> branchOpeningTimes) {
- FinancialsAdminBranchOfficeWebRequestBean.branchOpeningTimes = branchOpeningTimes;
+ JobsAdminBranchOfficeWebRequestBean.branchOpeningTimes = branchOpeningTimes;
}
/**
*/
private BranchOffice createBranchOffice () {
// Create new branch office instance
- final BranchOffice branchOffice = new CompanyBranchOffice(this.getBranchCity(), this.getBranchCompany(), this.getBranchCountry(), this.getBranchStreet(), this.getBranchZipCode(), this.getBranchHouseNumber());
+ final BranchOffice branchOffice = new BusinessBranchOffice(this.getBranchCity(), this.getBranchCompany(), this.getBranchCountry(), this.getBranchStreet(), this.getBranchZipCode(), this.getBranchHouseNumber());
// Add all other fields, too
branchOffice.setBranchContactEmployee(this.getBranchContactEmployee());
import javax.inject.Inject;
import javax.inject.Named;
import org.mxchange.jcontactsbusiness.events.branchoffice.added.ObservableBranchOfficeAddedEvent;
+import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeNotFoundException;
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOfficeSessionBeanRemote;
import org.mxchange.jjobs.beans.BaseJobsBean;
return this.allBranchOffices;
}
+ @Override
+ public BranchOffice findBranchOfficeById (final Long branchOfficeId) throws BranchOfficeNotFoundException {
+ // Validate parameter
+ if (null == branchOfficeId) {
+ // Throw NPE
+ throw new NullPointerException("branchOfficeId is null"); //NOI18N
+ } else if (branchOfficeId < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException("branchOfficeId=" + branchOfficeId + " is invalid"); //NOI18N
+ } else if (!this.branchOfficeCache.containsKey(branchOfficeId)) {
+ // Not found
+ throw new BranchOfficeNotFoundException(branchOfficeId);
+ }
+
+ // Get it from cache
+ final BranchOffice branchOffice = this.branchOfficeCache.get(branchOfficeId);
+
+ // Return it
+ return branchOffice;
+ }
+
/**
* Getter for a list of filtered branch offices
* <p>
import java.io.Serializable;
import java.util.List;
+import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeNotFoundException;
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
/**
*/
List<BranchOffice> allBranchOffices ();
+ /**
+ * Tries to find a branch office with given id number
+ * <p>
+ * @param branchOfficeId Branch office id
+ * <p>
+ * @return A branch office instance
+ * <p>
+ * @throws BranchOfficeNotFoundException If the branch office was not found
+ */
+ BranchOffice findBranchOfficeById (final Long branchOfficeId) throws BranchOfficeNotFoundException;
+
}
import org.mxchange.jcontactsbusiness.events.department.added.DepartmentAddedEvent;
import org.mxchange.jcontactsbusiness.events.department.added.ObservableDepartmentAddedEvent;
import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentAlreadyAddedException;
-import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
import org.mxchange.jcontactsbusiness.model.department.AdminDepartmentSessionBeanRemote;
-import org.mxchange.jcontactsbusiness.model.department.CompanyDepartment;
+import org.mxchange.jcontactsbusiness.model.department.BusinessDepartment;
import org.mxchange.jcontactsbusiness.model.department.Department;
import org.mxchange.jcontactsbusiness.model.department.Departments;
-import org.mxchange.jcontactsbusiness.model.employee.Employee;
import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData;
import org.mxchange.jjobs.beans.BaseJobsBean;
import org.mxchange.jusercore.model.user.User;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
/**
* An administrative bean for departments
/**
* Assigned company for this department
*/
- private BusinessBasicData departmentCompany;
+ private BasicData departmentCompany;
/**
* A general department controller (backing bean)
/**
* Lead person of this department
*/
- private Employee departmentLead;
+ private Employable departmentLead;
/**
* Department name
* <p>
* @return Basic company data
*/
- public BusinessBasicData getDepartmentCompany () {
+ public BasicData getDepartmentCompany () {
return this.departmentCompany;
}
* <p>
* @param departmentCompany Basic company data
*/
- public void setDepartmentCompany (final BusinessBasicData departmentCompany) {
+ public void setDepartmentCompany (final BasicData departmentCompany) {
this.departmentCompany = departmentCompany;
}
* <p>
* @return Department contact person
*/
- public Employee getDepartmentLead () {
+ public Employable getDepartmentLead () {
return this.departmentLead;
}
* <p>
* @param departmentLead Department contact person
*/
- public void setDepartmentLead (final Employee departmentLead) {
+ public void setDepartmentLead (final Employable departmentLead) {
this.departmentLead = departmentLead;
}
*/
private Department createDepartment () {
// Create new department instance
- final Department department = new CompanyDepartment(this.getDepartmentCompany(), this.getDepartmentI18nKey());
+ final Department department = new BusinessDepartment(this.getDepartmentCompany(), this.getDepartmentI18nKey());
// Add all optional fields
department.setDepartmentHeadquarters(this.getDepartmentHeadquarters());
import javax.inject.Inject;
import javax.inject.Named;
import org.mxchange.jcontactsbusiness.events.department.added.ObservableDepartmentAddedEvent;
+import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentNotFoundException;
import org.mxchange.jcontactsbusiness.model.department.Department;
import org.mxchange.jcontactsbusiness.model.department.DepartmentSessionBeanRemote;
import org.mxchange.jjobs.beans.BaseJobsBean;
return this.allDepartments;
}
+ @Override
+ public Department findDepartmentById (final Long departmentId) throws DepartmentNotFoundException {
+ // Validate parameter
+ if (null == departmentId) {
+ // Throw NPE
+ throw new NullPointerException("departmentId is null"); //NOI18N
+ } else if (departmentId < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException("departmentId=" + departmentId + " is invalid"); //NOI18N
+ } else if (!this.departmentCache.containsKey(departmentId)) {
+ // Not found
+ throw new DepartmentNotFoundException(departmentId);
+ }
+
+ // Get it from cache
+ final Department department = this.departmentCache.get(departmentId);
+
+ // Return it
+ return department;
+ }
+
/**
* Getter for a list of filtered departments
* <p>
import java.io.Serializable;
import java.util.List;
+import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentNotFoundException;
import org.mxchange.jcontactsbusiness.model.department.Department;
/**
*/
List<Department> allDepartments ();
+ /**
+ * Retrieves a single company department entity for given id number or
+ * throws a proper exception if not found.
+ * <p>
+ * @param departmentId Company department id to lookup
+ * <p>
+ * @return Company department instance
+ * <p>
+ * @throws DepartmentNotFoundException If the id number could not be
+ * looked up and solved into an entity
+ */
+ Department findDepartmentById (final Long departmentId) throws DepartmentNotFoundException;
+
}
import javax.inject.Named;
import org.mxchange.jcontacts.model.contact.Contact;
import org.mxchange.jcontactsbusiness.events.employee.added.ObservableEmployeeAddedEvent;
-import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
import org.mxchange.jcontactsbusiness.model.department.Department;
-import org.mxchange.jcontactsbusiness.model.employee.AdminCompanyEmployeeSessionBeanRemote;
+import org.mxchange.jcontactsbusiness.model.employee.AdminEmployeeSessionBeanRemote;
import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData;
import org.mxchange.jjobs.beans.BaseJobsBean;
import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
import org.mxchange.jusercore.model.user.User;
/**
- * A request-scoped bean for administrative purposes for company employees.
+ * A request-scoped bean for administrative purposes for administrative employee
+ * purposes.
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
/**
* EJB for administrative company employee purposes
*/
- @EJB (lookup = "java:global/jjobs-ejb/adminEmployee!org.mxchange.jcontactsbusiness.model.employee.AdminCompanyEmployeeSessionBeanRemote")
- private AdminCompanyEmployeeSessionBeanRemote adminEmployeeBean;
+ @EJB (lookup = "java:global/jjobs-ejb/adminEmployee!org.mxchange.jcontactsbusiness.model.employee.AdminEmployeeSessionBeanRemote")
+ private AdminEmployeeSessionBeanRemote adminEmployeeBean;
/**
- * Assigned branch office
+ * Assigned basic data instance
*/
- private BranchOffice employeeBranchOffice;
+ private BasicData employeeBasicData;
/**
- * Assigned basic data instance
+ * Assigned branch office
*/
- private BusinessBasicData employeeCompany;
+ private BranchOffice employeeBranchOffice;
/**
* Department where employee works (alternative to headquarters)
* <p>
* @return Employee's assigned basic company data
*/
- public BusinessBasicData getEmployeeCompany () {
- return this.employeeCompany;
+ public BasicData getEmployeeCompany () {
+ return this.employeeBasicData;
}
/**
* Setter for employee's assigned basic company data
* <p>
- * @param employeeCompany Employee's assigned basic company data
+ * @param employeeBasicData Employee's assigned basic company data
*/
- public void setEmployeeCompany (final BusinessBasicData employeeCompany) {
- this.employeeCompany = employeeCompany;
+ public void setEmployeeCompany (final BasicData employeeBasicData) {
+ this.employeeBasicData = employeeBasicData;
}
/**
import javax.inject.Inject;
import javax.inject.Named;
import org.mxchange.jcontactsbusiness.events.employee.added.ObservableEmployeeAddedEvent;
-import org.mxchange.jcontactsbusiness.model.employee.CompanyEmployeeSessionBeanRemote;
-import org.mxchange.jcontactsbusiness.model.employee.Employee;
+import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontactsbusiness.model.employee.EmployeeSessionBeanRemote;
import org.mxchange.jjobs.beans.BaseJobsBean;
/**
/**
* List of all employees
*/
- private final List<Employee> allEmployees;
+ private final List<Employable> allEmployees;
/**
* EJB for general company employee purposes
*/
- @EJB (lookup = "java:global/jjobs-ejb/employee!org.mxchange.jcontactsbusiness.model.employee.CompanyEmployeeSessionBeanRemote")
- private CompanyEmployeeSessionBeanRemote employeeBean;
+ @EJB (lookup = "java:global/jjobs-ejb/employee!org.mxchange.jcontactsbusiness.model.employee.EmployeeSessionBeanRemote")
+ private EmployeeSessionBeanRemote employeeBean;
/**
* List of all company employees
*/
@Inject
@NamedCache (cacheName = "companyEmployeeCache")
- private Cache<Long, Employee> employeeCache;
+ private Cache<Long, Employable> employeeCache;
/**
* A list of filtered employees
*/
- private List<Employee> filteredEmployees;
+ private List<Employable> filteredEmployees;
/**
* Default constructor
* @return List of all company employees
*/
@SuppressWarnings ("ReturnOfCollectionOrArrayField")
- public List<Employee> allCompanyEmployees () {
+ public List<Employable> allEmployees () {
return this.allEmployees;
}
+ @Override
+ public Employable findEmployeeById (final Long employeeId) throws EmployeeNotFoundException {
+ // Validate parameter
+ if (null == employeeId) {
+ // Throw NPE
+ throw new NullPointerException("employeeId is null"); //NOI18N
+ } else if (employeeId < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException("employeeId=" + employeeId + " is invalid"); //NOI18N
+ } else if (!this.employeeCache.containsKey(employeeId)) {
+ // Not found
+ throw new EmployeeNotFoundException(employeeId);
+ }
+
+ // Get it from cache
+ final Employable employee = this.employeeCache.get(employeeId);
+
+ // Return it
+ return employee;
+ }
+
/**
* Getter for filtered list of employees
* <p>
* @return Filtered list of employees
*/
@SuppressWarnings ("ReturnOfCollectionOrArrayField")
- public List<Employee> getFilteredEmployees () { //NOI18N
+ public List<Employable> getFilteredEmployees () { //NOI18N
return this.filteredEmployees;
}
* @param filteredEmployees Filtered list of employees
*/
@SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
- public void setFilteredEmployees (final List<Employee> filteredEmployees) { //NOI18N
+ public void setFilteredEmployees (final List<Employable> filteredEmployees) { //NOI18N
this.filteredEmployees = filteredEmployees;
}
// Is cache there?
if (!this.employeeCache.iterator().hasNext()) {
// Get whole list
- final List<Employee> employees = this.employeeBean.allCompanyEmployees();
+ final List<Employable> employees = this.employeeBean.allEmployees();
// Add all
- for (final Employee employee : employees) {
+ for (final Employable employee : employees) {
// Add it to cache
this.employeeCache.put(employee.getEmployeeId(), employee);
}
// Is cache filled and list is empty
if ((this.employeeCache.iterator().hasNext()) && (this.allEmployees.isEmpty())) {
// Get iterator
- final Iterator<Cache.Entry<Long, Employee>> iterator = this.employeeCache.iterator();
+ final Iterator<Cache.Entry<Long, Employable>> iterator = this.employeeCache.iterator();
// Build up list
while (iterator.hasNext()) {
// GEt next element
- final Cache.Entry<Long, Employee> next = iterator.next();
+ final Cache.Entry<Long, Employable> next = iterator.next();
// Add to list
this.allEmployees.add(next.getValue());
}
// Sort list
- this.allEmployees.sort(new Comparator<Employee>() {
+ this.allEmployees.sort(new Comparator<Employable>() {
@Override
- public int compare (final Employee o1, final Employee o2) {
+ public int compare (final Employable o1, final Employable o2) {
return o1.getEmployeeId() > o2.getEmployeeId() ? 1 : o1.getEmployeeId() < o2.getEmployeeId() ? -1 : 0;
}
});
package org.mxchange.jjobs.beans.business.employee;
import java.io.Serializable;
+import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
/**
* An interface for request-scoped general company employee beans
*/
public interface JobsEmployeeWebRequestController extends Serializable {
+ /**
+ * Finds a company employee by given employee id
+ * <p>
+ * @param employeeId Employable id to find company employee instance for
+ * <p>
+ * @return Company employee instance
+ * <p>
+ * @throws EmployeeNotFoundException If the company employee was not found
+ */
+ Employable findEmployeeById (final Long employeeId) throws EmployeeNotFoundException;
+
}
import javax.inject.Inject;
import javax.inject.Named;
import org.mxchange.jcontactsbusiness.events.opening_time.added.ObservableOpeningTimeAddedEvent;
+import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTimeSessionBeanRemote;
import org.mxchange.jjobs.beans.BaseJobsBean;
return this.allOpeningTimes;
}
+ @Override
+ public OpeningTime findOpeningTimeById (final Long openingId) throws OpeningTimeNotFoundException {
+ // Validate parameter
+ if (null == openingId) {
+ // Throw NPE
+ throw new NullPointerException("openingId is null"); //NOI18N
+ } else if (openingId < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException("openingId=" + openingId + " is invalid"); //NOI18N
+ } else if (!this.openingTimesCache.containsKey(openingId)) {
+ // Not found
+ throw new OpeningTimeNotFoundException(openingId);
+ }
+
+ // Get it from cache
+ final OpeningTime opening = this.openingTimesCache.get(openingId);
+
+ // Return it
+ return opening;
+ }
+
/**
* Getter for a list of filtered opening times
* <p>
import java.io.Serializable;
import java.util.List;
+import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
/**
*/
List<OpeningTime> allOpeningTimes ();
+ /**
+ * Retrieves a single company department entity for given id number or
+ * throws a proper exception if not found.
+ * <p>
+ * @param openingId Company department id to lookup
+ * <p>
+ * @return Company department instance
+ * <p>
+ * @throws OpeningTimeNotFoundException If the id number could not be looked
+ * up and solved into an entity
+ */
+ OpeningTime findOpeningTimeById (final Long openingId) throws OpeningTimeNotFoundException;
+
}
import javax.inject.Named;
import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
import org.mxchange.jcontacts.model.contact.Contact;
import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote;
import org.mxchange.jcontacts.model.contact.ContactUtils;
* Contact list
*/
@Inject
- @NamedCache (cacheName = "contactsCache")
- private Cache<Long, Contact> contactsCache;
+ @NamedCache (cacheName = "contactCache")
+ private Cache<Long, Contact> contactCache;
/**
* Country instance
final List<Contact> list = new LinkedList<>();
// Get iterator
- final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactsCache.iterator();
+ final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactCache.iterator();
// Loop over all
while (iterator.hasNext()) {
return "contact_data_saved"; //NOI18N
}
+ @Override
+ public Contact findContactById (final Long contactId) throws ContactNotFoundException {
+ // Validate parameter
+ if (null == contactId) {
+ // Throw NPE
+ throw new NullPointerException("contactId is null"); //NOI18N
+ } else if (contactId < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException("contactId=" + contactId + " is invalid"); //NOI18N
+ } else if (!this.contactCache.containsKey(contactId)) {
+ // Not found
+ throw new ContactNotFoundException(contactId);
+ }
+
+ // Get it from cache
+ final Contact contact = this.contactCache.get(contactId);
+
+ // Return it
+ return contact;
+ }
+
/**
* Getter for academic title
* <p>
@PostConstruct
public void init () {
// Is cache there?
- if (!this.contactsCache.iterator().hasNext()) {
+ if (!this.contactCache.iterator().hasNext()) {
// Get whole list
final List<Contact> contacts = this.contactBean.allContacts();
// Add all
for (final Contact contact : contacts) {
// Add it to cache
- this.contactsCache.put(contact.getContactId(), contact);
+ this.contactCache.put(contact.getContactId(), contact);
this.emailAddressCache.put(contact.getContactId(), contact.getContactEmailAddress());
}
} else if (this.selectableContactsCache.iterator().hasNext()) {
final List<User> allUsers = this.userController.allUsers();
// Get iterator from contacts cache
- final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactsCache.iterator();
+ final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactCache.iterator();
// Loop through all contacts
while (iterator.hasNext()) {
return ((this.emailAddressCache instanceof List) && (this.emailAddressCache.containsKey(contact.getContactId())));
}
+ @Override
+ public boolean isEmailAddressRegistered (String emailAddress) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
@Override
public boolean isRequiredChangePersonalDataSet () {
return ((this.getPersonalTitle() != null) &&
final List<Contact> selectableContacts = new LinkedList<>();
// Get iterator from cache
- final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactsCache.iterator();
+ final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactCache.iterator();
// Loop through all contacts
while (iterator.hasNext()) {
}
// Remove from general list
- if (!this.contactsCache.remove(contact.getContactId())) {
+ if (!this.contactCache.remove(contact.getContactId())) {
// Did not remove contact
throw new IllegalStateException(MessageFormat.format("contact {0} was not removed.", contact.getContactId())); //NOI18N
}
}
// Get iterator from list
- final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactsCache.iterator();
+ final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactCache.iterator();
// "Walk" through all entries
while (iterator.hasNext()) {
}
// Add contact to list
- this.contactsCache.put(contact.getContactId(), contact);
+ this.contactCache.put(contact.getContactId(), contact);
}
}
import java.io.Serializable;
import java.util.List;
+import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
import org.mxchange.jcontacts.model.contact.Contact;
/**
*/
String doChangePersonalContactData ();
+ /**
+ * Returns a contact instance which has the given id number.
+ * <p>
+ * @param contactId Contact id
+ * <p>
+ * @return Contact instance
+ * <p>
+ * @throws ContactNotFoundException If the contact was not found
+ */
+ Contact findContactById (final Long contactId) throws ContactNotFoundException;
+
+ /**
+ * Checks whether the given email address is already registered. The email
+ * address should be validated by EmailAddressValidator before calling this
+ * method.
+ * <p>
+ * @param emailAddress Email address to check
+ * <p>
+ * @return Whether the email address is already registered
+ */
+ boolean isEmailAddressRegistered (final String emailAddress);
+
}
import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
import org.mxchange.jphone.events.landline.created.ObservableCreatedLandLineNumberEvent;
import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
-import org.mxchange.jphone.exceptions.PhoneNumberAlreadyLinkedException;
-import org.mxchange.jphone.exceptions.PhoneNumberNotLinkedException;
+import org.mxchange.jphone.exceptions.phone.PhoneNumberAlreadyLinkedException;
+import org.mxchange.jphone.exceptions.phone.PhoneNumberNotLinkedException;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
-import org.mxchange.jcountry.events.AdminAddedCountryEvent;
-import org.mxchange.jcountry.events.ObservableAdminAddedCountryEvent;
+import org.mxchange.jcountry.events.added.AdminAddedCountryEvent;
+import org.mxchange.jcountry.events.added.ObservableAdminAddedCountryEvent;
import org.mxchange.jcountry.exceptions.CountryAlreadyAddedException;
+import org.mxchange.jcountry.model.data.AdminCountrySessionBeanRemote;
import org.mxchange.jcountry.model.data.Country;
import org.mxchange.jcountry.model.data.CountryData;
-import org.mxchange.jcountry.model.data.CountrySingletonBeanRemote;
import org.mxchange.jjobs.beans.BaseJobsBean;
/**
private Event<ObservableAdminAddedCountryEvent> addedCountryEvent;
/**
- * Abroad dial prefix
+ * Remote country EJB
*/
- private String countryAbroadDialPrefix;
+ @EJB (lookup = "java:global/jjobs-ejb/adminCountry!org.mxchange.jcountry.model.data.AdminCountrySessionBeanRemote")
+ private AdminCountrySessionBeanRemote adminCountryBean;
/**
- * Remote country EJB
+ * Abroad dial prefix
*/
- @EJB (lookup = "java:global/jjobs-ejb/country!org.mxchange.jcountry.model.data.CountrySingletonBeanRemote")
- private CountrySingletonBeanRemote countryBean;
+ private String countryAbroadDialPrefix;
/**
* 2-letter country code
try {
// Send country to bean
- updatedCountry = this.countryBean.addCountry(country);
+ updatedCountry = this.adminCountryBean.addCountry(country);
} catch (final CountryAlreadyAddedException ex) {
// Throw again
throw new FaceletException(ex);
import javax.enterprise.event.Observes;
import javax.inject.Inject;
import javax.inject.Named;
-import org.mxchange.jcountry.events.ObservableAdminAddedCountryEvent;
+import org.mxchange.jcountry.events.added.ObservableAdminAddedCountryEvent;
+import org.mxchange.jcountry.exceptions.CountryNotFoundException;
import org.mxchange.jcountry.model.data.Country;
import org.mxchange.jcountry.model.data.CountrySingletonBeanRemote;
import org.mxchange.jjobs.beans.BaseJobsBean;
return list;
}
+ @Override
+ public Country findCountryById (final Long countryId) throws CountryNotFoundException {
+ // Validate parameter
+ if (null == countryId) {
+ // Throw NPE
+ throw new NullPointerException("countryId is null"); //NOI18N
+ } else if (countryId < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException("countryId=" + countryId + " is invalid"); //NOI18N
+ } else if (!this.countryCache.containsKey(countryId)) {
+ // Not found
+ throw new CountryNotFoundException(countryId);
+ }
+
+ // Get it from cache
+ final Country country = this.countryCache.get(countryId);
+
+ // Return it
+ return country;
+ }
+
/**
* Post-construction method
*/
import java.io.Serializable;
import java.util.List;
+import org.mxchange.jcountry.exceptions.CountryNotFoundException;
import org.mxchange.jcountry.model.data.Country;
/**
*/
List<Country> allCountries ();
+ /**
+ * Returns a country instance found by given primary key. If not found, a
+ * proper exception is thrown.
+ * <p>
+ * @param countryId Primary key
+ * <p>
+ * @return Country data instance
+ * <p>
+ * @throws CountryNotFoundException If the primary key was not found
+ */
+ public Country findCountryById (final Long countryId) throws CountryNotFoundException;
+
}
import org.mxchange.jcontacts.model.contact.Contact;
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
import org.mxchange.jcontactsbusiness.model.department.Department;
-import org.mxchange.jcontactsbusiness.model.employee.Employee;
import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData;
import org.mxchange.jjobs.beans.BaseJobsBean;
+import org.mxchange.jjobs.beans.localization.JobsLocalizationSessionController;
import org.mxchange.jjobs.beans.user.JobsUserWebRequestController;
+import org.mxchange.jjobs.model.receipt.BillableReceipt;
import org.mxchange.jphone.events.fax.created.CreatedFaxNumberEvent;
import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
import org.mxchange.jphone.events.landline.created.CreatedLandLineNumberEvent;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jproduct.model.product.Product;
import org.mxchange.jusercore.events.user.created.CreatedUserEvent;
import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent;
import org.mxchange.jusercore.model.user.User;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
/**
* A general helper for beans
@RequestScoped
public class JobsWebRequestHelperBean extends BaseJobsBean implements JobsWebRequestHelperController {
- /**
- * Call-stack instance (5 may show BeanELResolver.getValue as caller)
- */
- private static final short THREAD_STACK = 5;
-
/**
* Serial number
*/
@Inject
private Event<ObservableCreatedLandLineNumberEvent> landLineNumberCreatedEvent;
+ /**
+ * Localization controller
+ */
+ @Inject
+ private JobsLocalizationSessionController localizationController;
+
/**
* Mobile number
*/
* @param contact Contact instance
*/
public void setContact (final Contact contact) {
- // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName());
- // System.out.println(MessageFormat.format("{0}: Setting contact={1}, previous: {2}, caller: {3}", this.getClass().getSimpleName(), contact, this.contact, caller));
this.contact = contact;
}
* Returns the employee's number, personal title, family name and name if
* available. If null is provided, an empty string is returned.
* <p>
- * @param employee Employee instance
- * <p>
+ * @param employee Employable instance
+ <p>
* @return Contact's full name
*/
- public String renderEmployee (final Employee employee) {
+ public String renderEmployee (final Employable employee) {
// Default is empty string, so let's get started
final StringBuilder sb = new StringBuilder(20);
// Is employee set?
- if (employee instanceof Employee) {
+ if (employee instanceof Employable) {
// Then create name
sb.append(employee.getEmployeeNumber());
}
/**
- * Returns the headquarters' address. If null is provided, an empty string
- * is returned.
+ * Returns the headquarters address. If null is provided, an empty string is
+ * returned.
* <p>
* @param headquarters Headquarters instance
* <p>
- * @return Headquarters' address
+ * @return Headquarters address
*/
public String renderHeadquarters (final HeadquartersData headquarters) {
// Default is empty string, so let's get started
return sb.toString();
}
+ /**
+ * Returns the product name and price. If null is provided, an empty string
+ * is returned.
+ * <p>
+ * @param product Product instance
+ * <p>
+ * @return Product name
+ */
+ public String renderProduct (final Product product) {
+ // Default is empty string, so let's get started
+ final StringBuilder sb = new StringBuilder(10);
+
+ // Is a product set?
+ if (product instanceof Product) {
+ // Add name and price
+ sb.append(product.getProductTitle());
+ sb.append(" ("); //NOI18N
+ sb.append(this.localizationController.formatCurrency(product.getProductPrice()));
+ sb.append(")"); //NOI18N
+ }
+
+ // Return it
+ return sb.toString();
+ }
+
+ /**
+ * Returns the receipt. If null is provided, an empty string
+ * is returned.
+ * <p>
+ * @param receipt Receipt instance
+ * <p>
+ * @return Product name
+ */
+ public String renderReceipt (final BillableReceipt receipt) {
+ // Default is empty string, so let's get started
+ final StringBuilder sb = new StringBuilder(10);
+
+ // Is receipt set?
+ if (receipt instanceof BillableReceipt) {
+ // Add relevant data
+ sb.append(this.getMessageFromBundle("RECEIPT_ISSUED")).append(" "); //NOI18N
+ sb.append(this.getMessageFromBundle(receipt.getReceiptPaymentType().getI18nKey()));
+
+ // Is receipt number included?
+ if (receipt.getReceiptNumber() !=null) {
+ // Append it
+ sb.append(", ").append(this.getMessageFromBundle("RECEIPT_NUMBER")).append(" "); //NOI18N
+ sb.append(receipt.getReceiptNumber());
+ }
+
+ // Add company (over branch office)
+ sb.append(" ("); //NOI18N
+ sb.append(receipt.getReceiptBranchOffice().getBranchCompany().getCompanyName());
+ sb.append(")"); //NOI18N
+ }
+
+ // Return it
+ return sb.toString();
+ }
+
/**
* Set's all given contact's phone instances: land-line, mobile and
* faxNumber
package org.mxchange.jjobs.beans.localization;
import java.text.MessageFormat;
+import java.text.NumberFormat;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Locale;
@SessionScoped
public class JobsLocalizationSessionBean extends BaseJobsBean implements JobsLocalizationSessionController {
+ /**
+ * Number format
+ */
+ private static NumberFormat NUMBER_FORMAT;
+
/**
* Serial number
*/
// Call super constructor
super();
- // Init list
+ // Init locale list
this.supportedLocales = new LinkedHashMap<>(2);
}
// Then change it
this.changeLocale(newLocale, Boolean.TRUE);
+
+ // Change formatting
+ NUMBER_FORMAT = NumberFormat.getNumberInstance(newLocale);
+ }
+
+ @Override
+ public String formatCurrency (final Float amount) {
+ // Format amount
+ return NUMBER_FORMAT.format(amount);
}
/**
// Change locale, may set same back in faces context, but triggers event
this.changeLocale(requestLocale, Boolean.FALSE);
+
+ // Initial formatting, may change when user chooses other locale
+ NUMBER_FORMAT = NumberFormat.getNumberInstance(this.locale);
}
/**
*/
public interface JobsLocalizationSessionController extends Serializable {
+ /**
+ * Formats a float into a currency, depending on current locale
+ * <p>
+ * @param amount Amount (price) to format
+ * <p>
+ * @return Formatted string
+ */
+ String formatCurrency (final Float amount);
+
}
import org.mxchange.jjobs.beans.BaseJobsBean;
import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
import org.mxchange.jphone.events.mobileprovider.added.AdminMobileProviderAddedEvent;
-import org.mxchange.jphone.exceptions.MobileProviderAlreadyAddedException;
+import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderAlreadyAddedException;
import org.mxchange.jphone.model.phonenumbers.mobileprovider.AdminMobileProviderSessionBeanRemote;
import org.mxchange.jphone.model.phonenumbers.mobileprovider.CellphoneProvider;
import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
import javax.inject.Named;
import org.mxchange.jjobs.beans.BaseJobsBean;
import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
+import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderNotFoundException;
import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote;
return this.allMobileProviders;
}
+ @Override
+ public MobileProvider findMobileProviderById (final Long mobileProviderId) throws MobileProviderNotFoundException {
+ // Validate parameter
+ if (null == mobileProviderId) {
+ // Throw NPE
+ throw new NullPointerException("mobileProviderId is null"); //NOI18N
+ } else if (mobileProviderId < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException("mobileProviderId=" + mobileProviderId + " is invalid."); //NOI18N
+ } else if (!this.mobileProviderCache.containsKey(mobileProviderId)) {
+ // Not found
+ throw new MobileProviderNotFoundException(mobileProviderId);
+ }
+
+ // Get it from cache
+ final MobileProvider mobileProvider = this.mobileProviderCache.get(mobileProviderId);
+
+ // Return it
+ return mobileProvider;
+ }
+
/**
* Getter for filtered mobile provider list
* <p>
import java.io.Serializable;
import java.util.List;
+import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderNotFoundException;
import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
/**
*/
public interface JobsMobileProviderWebRequestController extends Serializable {
+ /**
+ * Returns a mobile provider instance by given primary key. If not found, a
+ * proper exception is thrown.
+ * <p>
+ * @param mobileProviderId Primary key
+ * <p>
+ * @return Mobile provider instance
+ * <p>
+ * @throws MobileProviderNotFoundException If the primary key could not be
+ * found
+ */
+ MobileProvider findMobileProviderById (final Long mobileProviderId) throws MobileProviderNotFoundException;
+
/**
* Returns a list of all mobile providers
* <p>
import org.mxchange.jphone.events.landline.updated.AdminUpdatedLandLineNumberEvent;
import org.mxchange.jphone.events.mobile.deleted.AdminDeletedMobileNumberEvent;
import org.mxchange.jphone.events.mobile.updated.AdminUpdatedMobileNumberEvent;
+import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
throw new NullPointerException("event is null"); //NOI18N
} else if (event.getContact() == null) {
// Throw again ...
- throw new NullPointerException("event.contact is null");
+ throw new NullPointerException("event.contact is null"); //NOI18N
} else if (event.getContact().getContactId() == null) {
// Throw again ...
- throw new NullPointerException("event.contact.contactId is null");
+ throw new NullPointerException("event.contact.contactId is null"); //NOI18N
} else if (event.getContact().getContactId() < 1) {
// Throw again ...
- throw new NullPointerException("event.contact.contactId=" + event.getContact().getContactId() + " is invalid");
+ throw new NullPointerException("event.contact.contactId=" + event.getContact().getContactId() + " is invalid"); //NOI18N
} else if (event.getContact().getContactFaxNumber() == null) {
// Throw again ...
- throw new NullPointerException("event.contact.contactFaxNumber is null");
+ throw new NullPointerException("event.contact.contactFaxNumber is null"); //NOI18N
} else if (event.getContact().getContactFaxNumber().getPhoneId() == null) {
// Throw again ...
- throw new NullPointerException("event.contact.contactFaxNumber.phoneId is null");
+ throw new NullPointerException("event.contact.contactFaxNumber.phoneId is null"); //NOI18N
} else if (event.getContact().getContactFaxNumber().getPhoneId() < 1) {
// Throw again ...
- throw new NullPointerException("event.contact.contactFaxNumber.phoneId=" + event.getContact().getContactFaxNumber().getPhoneId() + " is invalid");
+ throw new NullPointerException("event.contact.contactFaxNumber.phoneId=" + event.getContact().getContactFaxNumber().getPhoneId() + " is invalid"); //NOI18N
} else if (event.getLinkedFaxNumber() == null) {
// Throw again ...
- throw new NullPointerException("event.linkedFaxNumer is null");
+ throw new NullPointerException("event.linkedFaxNumer is null"); //NOI18N
}
// Is the id number in linked number not set?
throw new NullPointerException("event is null"); //NOI18N
} else if (event.getContact() == null) {
// Throw again ...
- throw new NullPointerException("event.contact is null");
+ throw new NullPointerException("event.contact is null"); //NOI18N
} else if (event.getContact().getContactId() == null) {
// Throw again ...
- throw new NullPointerException("event.contact.contactId is null");
+ throw new NullPointerException("event.contact.contactId is null"); //NOI18N
} else if (event.getContact().getContactId() < 1) {
// Throw again ...
- throw new NullPointerException("event.contact.contactId=" + event.getContact().getContactId() + " is invalid");
+ throw new NullPointerException("event.contact.contactId=" + event.getContact().getContactId() + " is invalid"); //NOI18N
} else if (event.getContact().getContactLandLineNumber() == null) {
// Throw again ...
- throw new NullPointerException("event.contact.contactLandLineNumber is null");
+ throw new NullPointerException("event.contact.contactLandLineNumber is null"); //NOI18N
} else if (event.getContact().getContactLandLineNumber().getPhoneId() == null) {
// Throw again ...
- throw new NullPointerException("event.contact.contactLandLineNumber.phoneId is null");
+ throw new NullPointerException("event.contact.contactLandLineNumber.phoneId is null"); //NOI18N
} else if (event.getContact().getContactLandLineNumber().getPhoneId() < 1) {
// Throw again ...
- throw new NullPointerException("event.contact.contactLandLineNumber.phoneId=" + event.getContact().getContactLandLineNumber().getPhoneId() + " is invalid");
+ throw new NullPointerException("event.contact.contactLandLineNumber.phoneId=" + event.getContact().getContactLandLineNumber().getPhoneId() + " is invalid"); //NOI18N
} else if (event.getLinkedLandLineNumber() == null) {
// Throw again ...
- throw new NullPointerException("event.linkedLandLineNumer is null");
+ throw new NullPointerException("event.linkedLandLineNumer is null"); //NOI18N
}
// Is the id number in linked number not set?
throw new NullPointerException("event is null"); //NOI18N
} else if (event.getContact() == null) {
// Throw again ...
- throw new NullPointerException("event.contact is null");
+ throw new NullPointerException("event.contact is null"); //NOI18N
} else if (event.getContact().getContactId() == null) {
// Throw again ...
- throw new NullPointerException("event.contact.contactId is null");
+ throw new NullPointerException("event.contact.contactId is null"); //NOI18N
} else if (event.getContact().getContactId() < 1) {
// Throw again ...
- throw new NullPointerException("event.contact.contactId=" + event.getContact().getContactId() + " is invalid");
+ throw new NullPointerException("event.contact.contactId=" + event.getContact().getContactId() + " is invalid"); //NOI18N
} else if (event.getContact().getContactMobileNumber() == null) {
// Throw again ...
- throw new NullPointerException("event.contact.contactMobileNumber is null");
+ throw new NullPointerException("event.contact.contactMobileNumber is null"); //NOI18N
} else if (event.getContact().getContactMobileNumber().getPhoneId() == null) {
// Throw again ...
- throw new NullPointerException("event.contact.contactMobileNumber.phoneId is null");
+ throw new NullPointerException("event.contact.contactMobileNumber.phoneId is null"); //NOI18N
} else if (event.getContact().getContactMobileNumber().getPhoneId() < 1) {
// Throw again ...
- throw new NullPointerException("event.contact.contactMobileNumber.phoneId=" + event.getContact().getContactMobileNumber().getPhoneId() + " is invalid");
+ throw new NullPointerException("event.contact.contactMobileNumber.phoneId=" + event.getContact().getContactMobileNumber().getPhoneId() + " is invalid"); //NOI18N
} else if (event.getLinkedMobileNumber() == null) {
// Throw again ...
- throw new NullPointerException("event.linkedMobileNumer is null");
+ throw new NullPointerException("event.linkedMobileNumer is null"); //NOI18N
}
// Is the id number in linked number not set?
return list;
}
+ @Override
+ public DialableFaxNumber findFaxNumberById (final Long faxNumberId) throws PhoneEntityNotFoundException {
+ // Validate paramter
+ if (null == faxNumberId) {
+ // Throw NPE
+ throw new NullPointerException("faxNumberId is null"); //NOI18N
+ } else if (faxNumberId < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException("faxNumberId=" + faxNumberId + " is invalid."); //NOI18N
+ } else if (!this.faxNumberCache.containsKey(faxNumberId)) {
+ // Not found
+ throw new PhoneEntityNotFoundException(faxNumberId);
+ }
+
+ // Get it from cache
+ final DialableFaxNumber faxNumber = this.faxNumberCache.get(faxNumberId);
+
+ // Return it
+ return faxNumber;
+ }
+
+ @Override
+ public DialableLandLineNumber findLandLineNumberById (final Long landLineNumberId) throws PhoneEntityNotFoundException {
+ // Validate paramter
+ if (null == landLineNumberId) {
+ // Throw NPE
+ throw new NullPointerException("landLineNumberId is null"); //NOI18N
+ } else if (landLineNumberId < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException("landLineNumberId=" + landLineNumberId + " is invalid."); //NOI18N
+ } else if (!this.landLineNumberCache.containsKey(landLineNumberId)) {
+ // Not found
+ throw new PhoneEntityNotFoundException(landLineNumberId);
+ }
+
+ // Get it from cache
+ final DialableLandLineNumber landLineNumber = this.landLineNumberCache.get(landLineNumberId);
+
+ // Return it
+ return landLineNumber;
+ }
+
+ @Override
+ public DialableMobileNumber findMobileNumberById (final Long mobileNumberId) throws PhoneEntityNotFoundException {
+ // Validate paramter
+ if (null == mobileNumberId) {
+ // Throw NPE
+ throw new NullPointerException("mobileNumberId is null"); //NOI18N
+ } else if (mobileNumberId < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException("mobileNumberId=" + mobileNumberId + " is invalid."); //NOI18N
+ } else if (!this.mobileNumberCache.containsKey(mobileNumberId)) {
+ // Not found
+ throw new PhoneEntityNotFoundException(mobileNumberId);
+ }
+
+ // Get it from cache
+ final DialableMobileNumber mobileNumber = this.mobileNumberCache.get(mobileNumberId);
+
+ // Return it
+ return mobileNumber;
+ }
+
/**
* Post-construction method
*/
// Make sure the parameter is valid
if (null == faxNumber) {
// Throw NPE
- throw new NullPointerException("faxNumber is null");
+ throw new NullPointerException("faxNumber is null"); //NOI18N
} else if (faxNumber.getPhoneId() == null) {
// Throw again ...
- throw new NullPointerException("faxNumber.phoneId is null");
+ throw new NullPointerException("faxNumber.phoneId is null"); //NOI18N
} else if (faxNumber.getPhoneId() < 1) {
// Not valid
- throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is not valid.", faxNumber.getPhoneId()));
+ throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is not valid.", faxNumber.getPhoneId())); //NOI18N
}
// First remove it
// Make sure the parameter is valid
if (null == landLineNumber) {
// Throw NPE
- throw new NullPointerException("landLineNumber is null");
+ throw new NullPointerException("landLineNumber is null"); //NOI18N
} else if (landLineNumber.getPhoneId() == null) {
// Throw again ...
- throw new NullPointerException("landLineNumber.phoneId is null");
+ throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
} else if (landLineNumber.getPhoneId() < 1) {
// Not valid
- throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneId={0} is not valid.", landLineNumber.getPhoneId()));
+ throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneId={0} is not valid.", landLineNumber.getPhoneId())); //NOI18N
}
// First remove it
// Make sure the parameter is valid
if (null == mobileNumber) {
// Throw NPE
- throw new NullPointerException("mobileNumber is null");
+ throw new NullPointerException("mobileNumber is null"); //NOI18N
} else if (mobileNumber.getPhoneId() == null) {
// Throw again ...
- throw new NullPointerException("mobileNumber.phoneId is null");
+ throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
} else if (mobileNumber.getPhoneId() < 1) {
// Not valid
- throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid.", mobileNumber.getPhoneId()));
+ throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid.", mobileNumber.getPhoneId())); //NOI18N
}
// First remove it by object
// Parameter must be valid
if (null == contact) {
// Throw NPE
- throw new NullPointerException("contact is null");
+ throw new NullPointerException("contact is null"); //NOI18N
} else if (contact.getContactId() == null) {
// Throw again
- throw new NullPointerException("contact.contactId is null");
+ throw new NullPointerException("contact.contactId is null"); //NOI18N
} else if (contact.getContactId() < 1) {
// Id number is not valid
}
import java.io.Serializable;
import java.util.List;
+import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
*/
List<DialableLandLineNumber> allLandLineNumbers ();
+ /**
+ * Finds a fax entry by given id number
+ * <p>
+ * @param faxNumberId Fax entry id number
+ * <p>
+ * @return A valid fax instance
+ * <p>
+ * @throws PhoneEntityNotFoundException If the entity was not found
+ */
+ DialableFaxNumber findFaxNumberById (final Long faxNumberId) throws PhoneEntityNotFoundException;
+
+ /**
+ * Finds a land-line entry by given id number
+ * <p>
+ * @param landLineNumberId Land-line entry id number
+ * <p>
+ * @return A valid land-line instance
+ * <p>
+ * @throws PhoneEntityNotFoundException If the entity was not found
+ */
+ DialableLandLineNumber findLandLineNumberById (final Long landLineNumberId) throws PhoneEntityNotFoundException;
+
+ /**
+ * Finds a mobile entry by given id number
+ * <p>
+ * @param mobileNumberId Mobile entry id number
+ * <p>
+ * @return A valid mobile instance
+ * <p>
+ * @throws PhoneEntityNotFoundException If the entity was not found
+ */
+ DialableMobileNumber findMobileNumberById (Long mobileNumberId) throws PhoneEntityNotFoundException;
+
}
// Is the parameter valid?
if (null == event) {
// Throw NPE
- throw new NullPointerException("event is null");
+ throw new NullPointerException("event is null"); //NOI18N
} else if (event.getLocale() == null) {
// Throw NPE again
- throw new NullPointerException("event.locale is null");
+ throw new NullPointerException("event.locale is null"); //NOI18N
}
// Set it here
// Is it valid?
if (null == event) {
// Throw NPE
- throw new NullPointerException("event is null");
+ throw new NullPointerException("event is null"); //NOI18N
}
// Clear it
// Is it valid?
if (null == event) {
// Throw NPE
- throw new NullPointerException("event is null");
+ throw new NullPointerException("event is null"); //NOI18N
}
// Clear it
return "user_contact_data_saved"; //NOI18N
}
+ @Override
+ public User findUserById (final Long userId) throws UserNotFoundException {
+ // Validate parameter
+ if (null == userId) {
+ // Throw NPE
+ throw new NullPointerException("userId is null"); //NOI18N
+ } else if (userId < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException("userId=" + userId + " is invalid."); //NOI18N
+ } else if (!this.userCache.containsKey(userId)) {
+ // Not found
+ throw new UserNotFoundException(userId);
+ }
+
+ // Get it from cache
+ final User user = this.userCache.get(userId);
+
+ // Return it
+ return user;
+ }
+
/**
* Getter for filtered users list
* <p>
((this.getUserPasswordRepeat() == null) || (this.getUserPasswordRepeat().isEmpty())));
}
+ @Override
+ public boolean ifUserIdExists (final Long userId) {
+ // Validate parameter
+ if (null == userId) {
+ // Throw NPE
+ throw new NullPointerException("userId is null"); //NOI18N
+ } else if (userId < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException("userId=" + userId + " is invalid."); //NOI18N
+ }
+
+ // Check if key is there
+ boolean isFound = this.userCache.containsKey(userId);
+
+ // Return flag
+ return isFound;
+ }
+
/**
* Post-initialization of this class
*/
@Deprecated
public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
+ /**
+ * Returns a user instance by given primary key. If not found, a proper
+ * exception is thrown.
+ * <p>
+ * @param userId User id
+ * <p>
+ * @return User instance
+ * <p>
+ * @throws UserNotFoundException If the user is not found
+ */
+ User findUserById (final Long userId) throws UserNotFoundException;
+
+ /**
+ * Checks if given user id exists
+ * <p>
+ * @param userId User id to check
+ * <p>
+ * @return Whether the user id exists
+ */
+ boolean ifUserIdExists (final Long userId);
+
/**
* Getter for clear-text user password
* <p>
boolean isContactFound (final Contact contact);
/**
- * Checks whether given user instance's name is used
+ * Checks whether given user instance name is used
* <p>
- * @param user User instance's name to check
+ * @param user User instance name to check
* <p>
* @return Whether it is already used
*/
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicCompanyDataNotFoundException;
-import org.mxchange.jcontactsbusiness.model.basicdata.BasicCompanyDataSessionBeanRemote;
-import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
+import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataNotFoundException;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
+import org.mxchange.jjobs.beans.business.basicdata.JobsBusinessDataWebRequestController;
/**
* Converter for basic company data id <-> valid basic company data instance
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@FacesConverter ("BusinessContactConverter")
-public class JobsBusinessContactConverter implements Converter<BusinessBasicData> {
+@FacesConverter ("BasicCompanyDataConverter")
+public class JobsBasicCompanyDataConverter implements Converter<BasicData> {
/**
- * Basic company data EJB
+ * Basic company data backing bean
*/
- private static BasicCompanyDataSessionBeanRemote BASIC_DATA_BEAN;
+ private static JobsBusinessDataWebRequestController BASIC_DATA_CONTROLLER;
@Override
- public BusinessBasicData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+ public BasicData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
// Is the instance there?
- if (BASIC_DATA_BEAN == null) {
+ if (BASIC_DATA_CONTROLLER == null) {
try {
// Not yet, attempt lookup
final Context initial = new InitialContext();
// Lookup EJB
- BASIC_DATA_BEAN = (BasicCompanyDataSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/basicCompanyData!org.mxchange.jcontactsbusiness.model.basicdata.BasicCompanyDataSessionBeanRemote"); //NOI18N
+ BASIC_DATA_CONTROLLER = (JobsBusinessDataWebRequestController) initial.lookup("java:module/basicCompanyDataController!org.mxchange.jjobs.beans.business.basicdata.JobsBusinessDataWebRequestController"); //NOI18N
} catch (final NamingException ex) {
// Throw it again
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex); //NOI18N
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex); //NOI18N
}
}
}
// Init instance
- BusinessBasicData basicData = null;
+ BasicData basicData = null;
try {
// Try to parse the value as long
final Long basicDataId = Long.valueOf(submittedValue);
// Try to get user instance from it
- basicData = BASIC_DATA_BEAN.findBasicDataById(basicDataId);
+ basicData = BASIC_DATA_CONTROLLER.findBasicDataById(basicDataId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
- } catch (final BasicCompanyDataNotFoundException ex) {
+ } catch (final BasicDataNotFoundException 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
}
}
@Override
- public String getAsString (final FacesContext context, final UIComponent component, final BusinessBasicData value) {
+ public String getAsString (final FacesContext context, final UIComponent component, final BasicData value) {
// Is the object null?
if ((null == value) || (String.valueOf(value).isEmpty())) {
// Is null
import javax.naming.NamingException;
import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeNotFoundException;
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
-import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOfficeSessionBeanRemote;
+import org.mxchange.jjobs.beans.business.branchoffice.JobsBranchOfficeWebRequestController;
/**
* Converter for branch office id <-> valid basic company data instance
/**
* Branch office EJB
*/
- private static BranchOfficeSessionBeanRemote BRANCH_OFFICE_BEAN;
+ private static JobsBranchOfficeWebRequestController BRANCH_OFFICE_CONTROLLER;
@Override
public BranchOffice getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
// Is the instance there?
- if (BRANCH_OFFICE_BEAN == null) {
+ if (BRANCH_OFFICE_CONTROLLER == null) {
try {
// Not yet, attempt lookup
final Context initial = new InitialContext();
// Lookup EJB
- BRANCH_OFFICE_BEAN = (BranchOfficeSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/branchOffice!org.mxchange.jcontactsbusiness.model.branchoffice.BranchOfficeSessionBeanRemote");
+ BRANCH_OFFICE_CONTROLLER = (JobsBranchOfficeWebRequestController) initial.lookup("java:module/branchOfficeController!org.mxchange.jjobs.beans.business.branchoffice.JobsBranchOfficeWebRequestController");
} catch (final NamingException ex) {
// Throw it again
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
}
}
final Long branchOfficeId = Long.valueOf(submittedValue);
// Try to get user instance from it
- branchOffice = BRANCH_OFFICE_BEAN.findBranchOfficeById(branchOfficeId);
+ branchOffice = BRANCH_OFFICE_CONTROLLER.findBranchOfficeById(branchOfficeId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
import javax.naming.NamingException;
import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentNotFoundException;
import org.mxchange.jcontactsbusiness.model.department.Department;
-import org.mxchange.jcontactsbusiness.model.department.DepartmentSessionBeanRemote;
+import org.mxchange.jjobs.beans.business.department.JobsDepartmentWebRequestController;
/**
* Converter for company department id <-> instance
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@FacesConverter ("CompanyDepartmentConverter")
-public class JobsCompanyDepartmentConverter implements Converter<Department> {
+@FacesConverter ("DepartmentConverter")
+public class JobsDepartmentConverter implements Converter<Department> {
/**
* Company department EJB
*/
- private static DepartmentSessionBeanRemote DEPARTMENT_BEAN;
+ private static JobsDepartmentWebRequestController DEPARTMENT_CONTROLLER;
@Override
public Department getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
// Is the instance there?
- if (DEPARTMENT_BEAN == null) {
+ if (DEPARTMENT_CONTROLLER == null) {
try {
// Not yet, attempt lookup
final Context initial = new InitialContext();
// Lookup EJB
- DEPARTMENT_BEAN = (DepartmentSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/companyDepartment!org.mxchange.jcontactsbusiness.model.department.CompanyDepartmentSessionBeanRemote"); //NOI18N
+ DEPARTMENT_CONTROLLER = (JobsDepartmentWebRequestController) initial.lookup("java:module/departmentController!org.mxchange.jjobs.beans.business.department.JobsDepartmentWebRequestController"); //NOI18N
} catch (final NamingException ex) {
// Throw it again
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex); //NOI18N
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex); //NOI18N
}
}
final Long departmentId = Long.valueOf(submittedValue);
// Try to get user instance from it
- companyDepartment = DEPARTMENT_BEAN.findDepartmentById(departmentId);
+ companyDepartment = DEPARTMENT_CONTROLLER.findDepartmentById(departmentId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
--- /dev/null
+/*
+ * 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.jjobs.converter.business.employee;
+
+import javax.faces.application.FacesMessage;
+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.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jjobs.beans.business.employee.JobsEmployeeWebRequestController;
+
+/**
+ * Converter for converting company employee to and from id number
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@FacesConverter ("EmployeeConverter")
+public class JobsEmployeeConverter implements Converter<Employable> {
+
+ /**
+ * Employable EJB
+ */
+ private static JobsEmployeeWebRequestController EMPLOYEE_CONTROLLER;
+
+ @Override
+ public Employable getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+ // Is the instance there?
+ if (EMPLOYEE_CONTROLLER == null) {
+ try {
+ // Not yet, attempt lookup
+ final Context initial = new InitialContext();
+
+ // Lookup EJB
+ EMPLOYEE_CONTROLLER = (JobsEmployeeWebRequestController) initial.lookup("java:module/!.JobsEmployeeWebRequestController"); //NOI18N
+ } catch (final NamingException ex) {
+ // Throw it again
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex); //NOI18N
+ }
+ }
+
+ // 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;
+ }
+
+ // Init instance
+ Employable companyEmployee = null;
+
+ try {
+ // Try to parse the value as long
+ final Long employeeId = Long.valueOf(submittedValue);
+
+ // Try to get user instance from it
+ companyEmployee = EMPLOYEE_CONTROLLER.findEmployeeById(employeeId);
+ } catch (final NumberFormatException ex) {
+ // Throw again
+ throw new ConverterException(ex);
+ } catch (final EmployeeNotFoundException 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 companyEmployee;
+ }
+
+ @Override
+ public String getAsString (final FacesContext context, final UIComponent component, final Employable value) {
+ // Is the object null?
+ if ((null == value) || (String.valueOf(value).isEmpty())) {
+ // Is null
+ return ""; //NOI18N
+ }
+
+ // Return id number
+ return String.valueOf(value.getEmployeeId());
+ }
+
+}
public class JobsCompanyHeadquartersConverter implements Converter<HeadquartersData> {
/**
- * CompanyEmployee EJB
+ * Headquarters backing bean
+ * @TODO Undone
*/
- private static CompanyHeadquartersSessionBeanRemote COMPANY_HEADQUARTERS_BEAN;
+ private static CompanyHeadquartersSessionBeanRemote HEADQUARTERS_CONTROLLER;
@Override
public HeadquartersData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
// Is the instance there?
- if (COMPANY_HEADQUARTERS_BEAN == null) {
+ if (HEADQUARTERS_CONTROLLER == null) {
try {
// Not yet, attempt lookup
final Context initial = new InitialContext();
// Lookup EJB
- COMPANY_HEADQUARTERS_BEAN = (CompanyHeadquartersSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/headquarters!org.mxchange.jcontactsbusiness.model.headquarters.CompanyHeadquartersSessionBeanRemote"); //NOI18N
+ HEADQUARTERS_CONTROLLER = (CompanyHeadquartersSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/headquarters!org.mxchange.jcontactsbusiness.model.headquarters.CompanyHeadquartersSessionBeanRemote"); //NOI18N
} catch (final NamingException ex) {
// Throw it again
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex); //NOI18N
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex); //NOI18N
}
}
final Long headquartersId = Long.valueOf(submittedValue);
// Try to get user instance from it
- companyHeadquarters = COMPANY_HEADQUARTERS_BEAN.findCompanyHeadquartersById(headquartersId);
+ companyHeadquarters = HEADQUARTERS_CONTROLLER.findCompanyHeadquartersById(headquartersId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
--- /dev/null
+/*
+ * 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.jjobs.converter.business.opening_time;
+
+import javax.faces.application.FacesMessage;
+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.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
+import org.mxchange.jjobs.beans.business.opening_time.JobsOpeningTimeWebRequestController;
+
+/**
+ * Converter for opening time id <-> instance
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@FacesConverter ("OpeningTimeConverter")
+public class JobsCompanyOpeningTimeConverter implements Converter<OpeningTime> {
+
+ /**
+ * Opening time backing bean
+ */
+ private static JobsOpeningTimeWebRequestController DEPARTMENT_CONTROLLER;
+
+ @Override
+ public OpeningTime getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+ // Is the instance there?
+ if (DEPARTMENT_CONTROLLER == null) {
+ try {
+ // Not yet, attempt lookup
+ final Context initial = new InitialContext();
+
+ // Lookup EJB
+ DEPARTMENT_CONTROLLER = (JobsOpeningTimeWebRequestController) initial.lookup("java:module/openingTimeController!org.mxchange.jjobs.beans.business.opening_time.JobsOpeningTimeWebRequestController"); //NOI18N
+ } catch (final NamingException ex) {
+ // Throw it again
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex); //NOI18N
+ }
+ }
+
+ // 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;
+ }
+
+ // Init instance
+ OpeningTime openingTime = null;
+
+ try {
+ // Try to parse the value as long
+ final Long openingId = Long.valueOf(submittedValue);
+
+ // Try to get user instance from it
+ openingTime = DEPARTMENT_CONTROLLER.findOpeningTimeById(openingId);
+ } catch (final NumberFormatException ex) {
+ // Throw again
+ throw new ConverterException(ex);
+ } catch (final OpeningTimeNotFoundException 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 openingTime;
+ }
+
+ @Override
+ public String getAsString (final FacesContext context, final UIComponent component, final OpeningTime value) {
+ // Is the object null?
+ if ((null == value) || (String.valueOf(value).isEmpty())) {
+ // Is null
+ return ""; //NOI18N
+ }
+
+ // Return id number
+ return String.valueOf(value.getOpeningId());
+ }
+
+}
import javax.naming.NamingException;
import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
import org.mxchange.jcontacts.model.contact.Contact;
-import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote;
+import org.mxchange.jjobs.beans.contact.JobsContactWebRequestController;
/**
* Converter for contact id <-> valid contact instance
/**
* User EJB
*/
- private static ContactSessionBeanRemote CONTACT_BEAN;
+ private static JobsContactWebRequestController CONTACT_CONTROLLER;
@Override
public Contact getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
// Is the instance there?
- if (CONTACT_BEAN == null) {
+ if (CONTACT_CONTROLLER == null) {
try {
// Not yet, attempt lookup
final Context initial = new InitialContext();
// Lookup EJB
- CONTACT_BEAN = (ContactSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/contact!org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote");
+ CONTACT_CONTROLLER = (JobsContactWebRequestController) initial.lookup("java:module/contactController!org.mxchange.jjobs.beans.contact.JobsContactWebRequestController");
} catch (final NamingException ex) {
// Throw it again
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
}
}
final Long contactId = Long.valueOf(submittedValue);
// Try to get user instance from it
- contact = CONTACT_BEAN.findContactById(contactId);
+ contact = CONTACT_CONTROLLER.findContactById(contactId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
*/
package org.mxchange.jjobs.converter.country;
-import java.util.List;
-import java.util.Objects;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import org.mxchange.jcountry.exceptions.CountryNotFoundException;
import org.mxchange.jcountry.model.data.Country;
-import org.mxchange.jcountry.model.data.CountrySingletonBeanRemote;
+import org.mxchange.jjobs.beans.country.JobsCountryWebRequestController;
/**
* Converter for country instance
public class JobsCountryConverter implements Converter<Country> {
/**
- * Country bean
+ * Country backing bean
*/
- private static CountrySingletonBeanRemote COUNTRY_BEAN;
+ private static JobsCountryWebRequestController COUNTRY_CONTROLLER;
@Override
public Country getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
// Is the instance there?
- if (COUNTRY_BEAN == null) {
+ if (COUNTRY_CONTROLLER == null) {
try {
// Not yet, attempt lookup
final Context initial = new InitialContext();
// Lookup EJB
- COUNTRY_BEAN = (CountrySingletonBeanRemote) initial.lookup("java:global/jjobs-ejb/country!org.mxchange.jcountry.model.data.CountrySingletonBeanRemote");
+ COUNTRY_CONTROLLER = (JobsCountryWebRequestController) initial.lookup("java:module/countryController!org.mxchange.jjobs.beans.country.JobsCountryWebRequestController");
} catch (final NamingException ex) {
// Throw it again
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
}
}
return null;
}
- // Get full list
- final List<Country> countryList = COUNTRY_BEAN.allCountries();
-
// Init value
Country country = null;
// Convert it to long
final Long countryId = Long.parseLong(submittedValue);
- // Category id should not be below 1
- assert (countryId > 0) : "countryId is smaller than one: " + countryId; //NOI18N
-
// Try to find it
- for (final Country cntry : countryList) {
- // Is the id the same? (null-safe)
- if (Objects.equals(cntry.getCountryId(), countryId)) {
- // Found it
- country = cntry;
- break;
- }
- }
+ country = COUNTRY_CONTROLLER.findCountryById(countryId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
+ } catch (final CountryNotFoundException ex) {
+ // Not handled
}
// Return it
+++ /dev/null
-/*
- * Copyright (C) 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.jjobs.converter.dayofweek;
-
-import javax.faces.convert.EnumConverter;
-import javax.faces.convert.FacesConverter;
-import org.mxchange.jcontactsbusiness.model.opening_time.dayofweek.DayOfTheWeek;
-
-/**
- * A converter for day of the week enumeration
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@FacesConverter("DayOfTheWeekConverter")
-public class JobsDayOfTheWeekConverter extends EnumConverter {
-
- /**
- * Default constructor which calls the super constructor with the proper
- * enumeration as class type.
- */
- public JobsDayOfTheWeekConverter () {
- super(DayOfTheWeek.class);
- }
-
-}
--- /dev/null
+/*
+ * Copyright (C) 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.jjobs.converter.dayofweek;
+
+import javax.faces.convert.EnumConverter;
+import javax.faces.convert.FacesConverter;
+import org.mxchange.jcontactsbusiness.model.opening_time.dayofweek.DayOfTheWeek;
+
+/**
+ * A converter for day of the week enumeration
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@FacesConverter("DayOfTheWeekConverter")
+public class JobsDayOfTheWeekConverter extends EnumConverter {
+
+ /**
+ * Default constructor which calls the super constructor with the proper
+ * enumeration as class type.
+ */
+ public JobsDayOfTheWeekConverter () {
+ super(DayOfTheWeek.class);
+ }
+
+}
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException;
+import org.mxchange.jjobs.beans.phone.JobsPhoneWebRequestController;
+import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote;
/**
* Converter for fax id <-> valid fax number instance
/**
* Phone EJB
*/
- private static PhoneSessionBeanRemote PHONE_BEAN;
+ private static JobsPhoneWebRequestController PHONE_CONTROLLER;
@Override
public DialableFaxNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
// Is the instance there?
- if (PHONE_BEAN == null) {
+ if (PHONE_CONTROLLER == null) {
try {
// Not yet, attempt lookup
final Context initial = new InitialContext();
// Lookup EJB
- PHONE_BEAN = (PhoneSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/phone!org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote");
+ PHONE_CONTROLLER = (JobsPhoneWebRequestController) initial.lookup("java:module/phoneController!org.mxchange.jphone.model.phonenumbers.phone.JobsPhoneWebRequestController");
} catch (final NamingException ex) {
// Throw it again
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
}
}
// Log message
// @TODO Not possible here: this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject: faxNumberId={1}", this.getClass().getSimpleName(), faxNumberId)); //NOI18N
// Try to get mobile instance from it
- faxNumber = PHONE_BEAN.findFaxNumberById(faxNumberId);
+ faxNumber = PHONE_CONTROLLER.findFaxNumberById(faxNumberId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException;
+import org.mxchange.jjobs.beans.phone.JobsPhoneWebRequestController;
+import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote;
/**
* Converter for land-line id <-> valid land-line number instance
/**
* Phone EJB
*/
- private static PhoneSessionBeanRemote PHONE_BEAN;
+ private static JobsPhoneWebRequestController PHONE_CONTROLLER;
@Override
public DialableLandLineNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
// Is the instance there?
- if (PHONE_BEAN == null) {
+ if (PHONE_CONTROLLER == null) {
try {
// Not yet, attempt lookup
final Context initial = new InitialContext();
// Lookup EJB
- PHONE_BEAN = (PhoneSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/phone!org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote");
+ PHONE_CONTROLLER = (JobsPhoneWebRequestController) initial.lookup("java:module/phoneController!org.mxchange.jphone.model.phonenumbers.phone.JobsPhoneWebRequestController");
} catch (final NamingException ex) {
// Throw it again
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
}
}
final Long landLineNumberId = Long.valueOf(submittedValue);
// Try to get mobile instance from it
- landLineNumber = PHONE_BEAN.findLandLineNumberById(landLineNumberId);
+ landLineNumber = PHONE_CONTROLLER.findLandLineNumberById(landLineNumberId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException;
+import org.mxchange.jjobs.beans.phone.JobsPhoneWebRequestController;
+import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote;
/**
* Converter for mobile id <-> valid mobile instance
/**
* Phone EJB
*/
- private static PhoneSessionBeanRemote PHONE_BEAN;
+ private static JobsPhoneWebRequestController PHONE_CONTROLLER;
@Override
public DialableMobileNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
// Is the instance there?
- if (PHONE_BEAN == null) {
+ if (PHONE_CONTROLLER == null) {
try {
// Not yet, attempt lookup
final Context initial = new InitialContext();
// Lookup EJB
- PHONE_BEAN = (PhoneSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/phone!org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote");
+ PHONE_CONTROLLER = (JobsPhoneWebRequestController) initial.lookup("java:module/phoneController!org.mxchange.jjobs.beans.phone.JobsPhoneWebRequestController");
} catch (final NamingException ex) {
// Throw it again
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
}
}
final Long mobileNumberId = Long.valueOf(submittedValue);
// Try to get mobile instance from it
- mobileNumber = PHONE_BEAN.findMobileNumberById(mobileNumberId);
+ mobileNumber = PHONE_CONTROLLER.findMobileNumberById(mobileNumberId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
*/
package org.mxchange.jjobs.converter.mobileprovider;
-import java.util.List;
-import java.util.Objects;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import org.mxchange.jjobs.beans.mobileprovider.JobsMobileProviderWebRequestController;
+import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderNotFoundException;
import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
-import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote;
/**
* Converter for SMS provider
public class JobsMobileProviderConverter implements Converter<MobileProvider> {
/**
- * Mobile provider bean
+ * Mobile provider backing bean
*/
- private static MobileProviderSingletonBeanRemote MOBILE_PROVIDER_BEAN;
+ private static JobsMobileProviderWebRequestController MOBILE_PROVIDER_CONTROLLER;
@Override
public MobileProvider getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
// Is the instance there?
- if (MOBILE_PROVIDER_BEAN == null) {
+ if (MOBILE_PROVIDER_CONTROLLER == null) {
try {
// Not yet, attempt lookup
final Context initial = new InitialContext();
// Lookup EJB
- MOBILE_PROVIDER_BEAN = (MobileProviderSingletonBeanRemote) initial.lookup("java:global/jjobs-ejb/mobileProvider!org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote");
+ MOBILE_PROVIDER_CONTROLLER = (JobsMobileProviderWebRequestController) initial.lookup("java:module/mobileProviderController!org.mxchange.jjobs.beans.mobileprovider.JobsMobileProviderWebRequestController");
} catch (final NamingException ex) {
// Throw it again
- throw new ConverterException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+ throw new ConverterException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
}
}
return null;
}
- // Get full list
- final List<MobileProvider> providerList = MOBILE_PROVIDER_BEAN.allMobileProviders();
-
// Init value
- MobileProvider provider = null;
+ MobileProvider mobileProvider = null;
// Try this better
try {
// Convert it to long
final Long providerId = Long.parseLong(submittedValue);
- // Category id should not be below 1
- assert (providerId > 0) : "providerId is smaller than one: " + providerId; //NOI18N
-
- // Try to find it
- for (final MobileProvider prov : providerList) {
- // Is the id the same? (null-safe)
- if (Objects.equals(prov.getProviderId(), providerId)) {
- // Found it
- provider = prov;
- break;
- }
- }
+ // Lookup of mobile provider
+ mobileProvider = MOBILE_PROVIDER_CONTROLLER.findMobileProviderById(providerId);
} catch (final NumberFormatException ex) {
+ // Throw again
+ throw new ConverterException(ex);
+ } catch (final MobileProviderNotFoundException ex) {
// Log exception (maybe to much?)
// @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logException(ex);
}
// Return it
- return provider;
+ return mobileProvider;
}
@Override
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import org.mxchange.jjobs.beans.user.JobsUserWebRequestController;
import org.mxchange.jusercore.exceptions.UserNotFoundException;
import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
/**
* Converter for user id <-> valid user instance
public class JobsUserConverter implements Converter<User> {
/**
- * User EJB
+ * User backing bean
*/
- private static UserSessionBeanRemote USER_BEAN;
+ private static JobsUserWebRequestController USER_CONTROLLER;
@Override
public User getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
// Is the instance there?
- if (USER_BEAN == null) {
+ if (USER_CONTROLLER == null) {
try {
// Not yet, attempt lookup
final Context initial = new InitialContext();
// Lookup EJB
- USER_BEAN = (UserSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote");
+ USER_CONTROLLER = (JobsUserWebRequestController) initial.lookup("java:module/userController!org.mxchange.jjobs.beans.user.JobsUserWebRequestController");
} catch (final NamingException ex) {
// Throw it again
- throw new ConverterException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+ throw new ConverterException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
}
}
final Long userId = Long.valueOf(submittedValue);
// Try to get user instance from it
- user = USER_BEAN.findUserById(userId);
+ user = USER_CONTROLLER.findUserById(userId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.mxchange.jcontactsbusiness.model.basicdata.BasicCompanyDataSessionBeanRemote;
import org.mxchange.jcoreee.validator.string.BaseStringValidator;
+import org.mxchange.jjobs.beans.business.basicdata.JobsBusinessDataWebRequestController;
/**
* A validator for company names
public class JobsCompanyNameValidator extends BaseStringValidator {
/**
- * Business contact EJB
+ * Business basic data backing bean
*/
- private static BasicCompanyDataSessionBeanRemote BASIC_DATA_BEAN;
+ private static JobsBusinessDataWebRequestController BASIC_DATA_CONTROLLER;
/**
* Serial number
@Override
public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
// Is the instance there?
- if (BASIC_DATA_BEAN == null) {
+ if (BASIC_DATA_CONTROLLER == null) {
try {
// Not yet, attempt lookup
final Context initial = new InitialContext();
// Lookup EJB
- BASIC_DATA_BEAN = (BasicCompanyDataSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/basicCompanyData!org.mxchange.jcontactsbusiness.model.basicdata.BasicCompanyDataSessionBeanRemote");
+ BASIC_DATA_CONTROLLER = (JobsBusinessDataWebRequestController) initial.lookup("java:module/basicCompanyDataController!org.mxchange.jjobs.beans.business.basicdata.JobsBusinessDataWebRequestController"); //NOI18N
} catch (final NamingException ex) {
// Throw it again
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
}
}
}
// Check if name is already used
- final Boolean nameExists = BASIC_DATA_BEAN.isCompanyNameUsed(companyName);
+ final Boolean nameExists = BASIC_DATA_CONTROLLER.isCompanyNameUsed(companyName);
// Is the user id valid?
if ((!nameExists) && (checkExisting)) {
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote;
import org.mxchange.jcoreee.validator.string.BaseStringValidator;
+import org.mxchange.jjobs.beans.contact.JobsContactWebRequestController;
/**
* A validator for email address validation
public class JobsEmailAddressValidator extends BaseStringValidator {
/**
- * Contact session-scoped bean
+ * Contact backing bean
*/
- private static ContactSessionBeanRemote CONTACT_BEAN;
+ private static JobsContactWebRequestController CONTACT_CONTROLLER;
/**
* Email pattern
@Override
public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
// Is the instance there?
- if (CONTACT_BEAN == null) {
+ if (CONTACT_CONTROLLER == null) {
try {
// Not yet, attempt lookup
final Context initial = new InitialContext();
// Lookup EJB
- CONTACT_BEAN = (ContactSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/contact!org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote");
+ CONTACT_CONTROLLER = (JobsContactWebRequestController) initial.lookup("java:module/contactController!org.mxchange.jjobs.beans.contact.JobsContactWebRequestController");
} catch (final NamingException ex) {
// Throw it again
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
}
}
final String clientId = component.getClientId();
// Is it registered?
- final Boolean isRegistered = CONTACT_BEAN.isEmailAddressRegistered(emailAddress);
+ final Boolean isRegistered = CONTACT_CONTROLLER.isEmailAddressRegistered(emailAddress);
// Is the email address already registered?
if ((!clientId.endsWith("resendEmailAddress")) && (isRegistered)) { //NOI18N
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.mxchange.jcoreee.validator.number.BaseNumberValidator;
-import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
+import org.mxchange.jjobs.beans.user.JobsUserWebRequestController;
/**
* A validator for user ids
public class JobsUserIdValidator extends BaseNumberValidator {
/**
- * Remote bean
+ * User backing bean
*/
- private static UserSessionBeanRemote USER_BEAN;
+ private static JobsUserWebRequestController USER_CONTROLLER;
/**
* Serial number
@Override
public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
// Is the instance there?
- if (USER_BEAN == null) {
+ if (USER_CONTROLLER == null) {
try {
// Not yet, attempt lookup
final Context initial = new InitialContext();
// Lookup EJB
- USER_BEAN = (UserSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote");
+ USER_CONTROLLER = (JobsUserWebRequestController) initial.lookup("java:module/userController!org.mxchange.jjobs.beans.user.JobsUserWebRequestController");
} catch (final NamingException ex) {
// Throw it again
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
}
}
final Long userId = (Long) value;
// Define variable
- final Boolean ifUserExists = USER_BEAN.ifUserIdExists(userId);
+ final Boolean ifUserExists = USER_CONTROLLER.ifUserIdExists(userId);
// Is the user id valid?
if (!ifUserExists) {
ADMIN_BRANCH_OFFICE_DATA_LEGEND=Grunddaten der Filiale:
#@TODO Please fix German umlauts!
ADMIN_BRANCH_OFFICE_DATA_LEGEND_TITLE=Geben Sie hier die Grunddaten der Filiale ein.
-ADMIN_ASSIGN_BRANCH_OFFICE_COMPANY=Filiale dem Unternehmen zuweisen:
+ADMIN_ASSIGN_BRANCH_OFFICE=Filiale dem Unternehmen zuweisen:
PAGE_TITLE_ADMIN_LIST_BRANCH_OFFICES=Filialen auflisten
CONTENT_TITLE_ADMIN_LIST_BRANCH_OFFICES=Auflisten von Filialen:
#@TODO Please fix German umlauts!
ADMIN_ENTER_BRANCH_OFFICE_PHONE_NUMBER=Telefonnummer eingeben:
ADMIN_ENTER_BRANCH_OFFICE_FAX_NUMBER=Faxnummer eingeben:
#@TODO Please fix German umlauts!
-ADMIN_BRANCH_OFFICE_COMPANY_REQUIRED=Bitte waehlen das zur Filiale gehoerende Unternehmen aus.
+ADMIN_BRANCH_OFFICE_REQUIRED=Bitte waehlen das zur Filiale gehoerende Unternehmen aus.
ADMIN_BRANCH_OFFICE_STREET_NAME_REQUIRED=Bitte geben Sie die Strasse der Filiale ein.
ADMIN_BRANCH_OFFICE_HOUSE_NUMBER_REQUIRED=Bitte geben Sie die Hausnummer der Filiale ein.
#@TODO Please fix German umlauts!
ADMIN_ASSIGN_BRANCH_OFFICE_CONTACT_EMPLOYEE=Assign contact person to branch office:
ADMIN_BRANCH_OFFICE_DATA_LEGEND=Branch office basic data:
ADMIN_BRANCH_OFFICE_DATA_LEGEND_TITLE=Enter branch office basic data here.
-ADMIN_ASSIGN_BRANCH_OFFICE_COMPANY=Assign branch office to company:
+ADMIN_ASSIGN_BRANCH_OFFICE=Assign branch office to company:
PAGE_TITLE_ADMIN_LIST_BRANCH_OFFICES=List branch offices
CONTENT_TITLE_ADMIN_LIST_BRANCH_OFFICES=List branch offices:
ADMIN_EMPTY_LIST_BRANCH_OFFICES=There are no branch offices found in database. Or your search criteria doesn't match anything.
ADMIN_ENTER_BRANCH_OFFICE_EMAIL_ADDRESS=Email address of branch office:
ADMIN_ENTER_BRANCH_OFFICE_PHONE_NUMBER=Enter land-line number:
ADMIN_ENTER_BRANCH_OFFICE_FAX_NUMBER=Enter fax number:
-ADMIN_BRANCH_OFFICE_COMPANY_REQUIRED=Please choose a company that sohuld be assigned with the branch office.
+ADMIN_BRANCH_OFFICE_REQUIRED=Please choose a company that sohuld be assigned with the branch office.
ADMIN_BRANCH_OFFICE_STREET_NAME_REQUIRED=Please enter street name of branch office.
ADMIN_BRANCH_OFFICE_HOUSE_NUMBER_REQUIRED=Please enter house number of branch office.
ENTERED_STORE_INVALID=The entered store is not valid.
</attribute>
</tag>
<tag>
- <tag-name>outputCompanyEmployeeAdminMiniLinks</tag-name>
+ <tag-name>outputEmployeeAdminMiniLinks</tag-name>
<description>This tag renders administrative "mini-links" for given employee instance.</description>
<source>resources/tags/admin/links/mini/employee/admin_employee_links.tpl</source>
<attribute>
filter="true"
filterMatchMode="contains"
>
- <f:converter converterId="CompanyEmployeeConverter" />
+ <f:converter converterId="EmployeeConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
- <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="companyHeadQuarters" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
+ <f:selectItems value="#{employeeController.allEmployees()}" var="companyHeadQuarters" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
</p:selectOneMenu>
<p:outputLabel for="companyFounder" value="#{msg.ADMIN_SELECT_BASIC_COMPANY_DATA_COMPANY_FOUNDER}" />
filter="true"
filterMatchMode="contains"
>
- <f:converter converterId="CompanyEmployeeConverter" />
+ <f:converter converterId="EmployeeConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
- <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="companyHeadQuarters" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
+ <f:selectItems value="#{employeeController.allEmployees()}" var="companyHeadQuarters" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
</p:selectOneMenu>
<p:outputLabel for="companyHeadQuarters" value="#{msg.ADMIN_SELECT_BASIC_COMPANY_DATA_COMPANY_HEADQUARTERS}" />
-->
<p:fieldset legend="#{msg.ADMIN_BRANCH_OFFICE_DATA_LEGEND}">
<p:panelGrid layout="grid" columns="2" columnClasses="ui-grid-col-4, ui-grid-col-8" styleClass="table table-full ui-noborder">
- <p:outputLabel for="branchCompany" value="#{msg.ADMIN_ASSIGN_BRANCH_OFFICE_COMPANY}" />
+ <p:outputLabel for="branchCompany" value="#{msg.ADMIN_ASSIGN_BRANCH_OFFICE}" />
<p:selectOneMenu
id="branchCompany"
value="#{adminBranchOfficeController.branchCompany}"
filter="true"
filterMatchMode="contains"
required="true"
- requiredMessage="#{msg.ADMIN_BRANCH_OFFICE_COMPANY_REQUIRED}"
+ requiredMessage="#{msg.ADMIN_BRANCH_OFFICE_REQUIRED}"
>
<f:converter converterId="BasicCompanyDataConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
- <f:selectItems value="#{basicCompanyDataController.allCompanyBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+ <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
</p:selectOneMenu>
<p:outputLabel for="branchContactEmployee" value="#{msg.ADMIN_ASSIGN_BRANCH_OFFICE_CONTACT_EMPLOYEE}" />
filter="true"
filterMatchMode="contains"
>
- <f:converter converterId="CompanyEmployeeConverter" />
+ <f:converter converterId="EmployeeConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
- <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="companyHeadQuarters" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
+ <f:selectItems value="#{employeeController.allEmployees()}" var="companyHeadQuarters" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
</p:selectOneMenu>
<p:outputLabel for="branchUserOwner" value="#{msg.ADMIN_ASSIGN_BRANCH_OFFICE_USER_OWNER}" />
>
<f:converter converterId="BasicCompanyDataConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
- <f:selectItems value="#{basicCompanyDataController.allCompanyBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+ <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
</p:selectOneMenu>
<p:outputLabel for="departmentBranchOffice" value="#{msg.ADMIN_ASSIGN_DEPARTMENT_BRANCH_OFFICE}" />
filter="true"
filterMatchMode="contains"
>
- <f:converter converterId="CompanyEmployeeConverter" />
+ <f:converter converterId="EmployeeConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
<f:selectItems value="#{headquartersController.allHeadquarters()}" var="headquarters" itemValue="#{headquarters}" itemLabel="#{beanHelper.renderHeadquarters(headquarters)}" />
</p:selectOneMenu>
filter="true"
filterMatchMode="contains"
>
- <f:converter converterId="CompanyEmployeeConverter" />
+ <f:converter converterId="EmployeeConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
- <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
+ <f:selectItems value="#{employeeController.allEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
</p:selectOneMenu>
<p:outputLabel for="departmentUserOwner" value="#{msg.ADMIN_ASSIGN_DEPARTMENT_USER_OWNER}" />
>
<f:converter converterId="BasicCompanyDataConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
- <f:selectItems value="#{basicCompanyDataController.allCompanyBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+ <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
</p:selectOneMenu>
<p:outputLabel for="employeeBranchOffice" value="#{msg.ADMIN_ASSIGN_EMPLOYEE_BRANCH_OFFICE}" />
filter="true"
filterMatchMode="contains"
>
- <f:converter converterId="CompanyDepartmentConverter" />
+ <f:converter converterId="DepartmentConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
<f:selectItems value="#{departmentController.allDepartments()}" var="department" itemValue="#{department}" itemLabel="#{beanHelper.renderDepartment(department)}" />
</p:selectOneMenu>
<p:dataTable
id="table-list-basic-company-data"
var="basicData"
- value="#{basicCompanyDataController.allCompanyBasicData()}"
+ value="#{basicCompanyDataController.allBasicData()}"
tableStyleClass="table table-full"
paginator="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
updateLabel="true"
title="#{msg.FILTER_BY_MULTIPLE_EMPLOYEES_TITLE}"
>
- <f:converter converterId="CompanyEmployeeConverter" />
+ <f:converter converterId="EmployeeConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
- <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
+ <f:selectItems value="#{employeeController.allEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
</p:selectCheckboxMenu>
</f:facet>
updateLabel="true"
title="#{msg.FILTER_BY_MULTIPLE_EMPLOYEES_TITLE}"
>
- <f:converter converterId="CompanyEmployeeConverter" />
+ <f:converter converterId="EmployeeConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
- <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
+ <f:selectItems value="#{employeeController.allEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
</p:selectCheckboxMenu>
</f:facet>
title="#{msg.FILTER_BY_MULTIPLE_COMPANIES_TITLE}"
>
<f:converter converterId="BasicCompanyDataConverter" />
- <f:selectItems value="#{basicCompanyDataController.allCompanyBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+ <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
</p:selectCheckboxMenu>
</f:facet>
updateLabel="true"
title="#{msg.FILTER_BY_MULTIPLE_EMPLOYEES_TITLE}"
>
- <f:converter converterId="CompanyEmployeeConverter" />
+ <f:converter converterId="EmployeeConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
- <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
+ <f:selectItems value="#{employeeController.allEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
</p:selectCheckboxMenu>
</f:facet>
title="#{msg.FILTER_BY_MULTIPLE_COMPANIES_TITLE}"
>
<f:converter converterId="BasicCompanyDataConverter" />
- <f:selectItems value="#{basicCompanyDataController.allCompanyBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+ <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
</p:selectCheckboxMenu>
</f:facet>
updateLabel="true"
title="#{msg.FILTER_BY_MULTIPLE_EMPLOYEES_TITLE}"
>
- <f:converter converterId="CompanyEmployeeConverter" />
+ <f:converter converterId="EmployeeConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
- <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
+ <f:selectItems value="#{employeeController.allEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
</p:selectCheckboxMenu>
</f:facet>
<p:dataTable
id="table-list-company-employees"
var="employee"
- value="#{employeeController.allCompanyEmployees()}"
+ value="#{employeeController.allEmployees()}"
tableStyleClass="table table-full"
paginator="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
title="#{msg.FILTER_BY_MULTIPLE_COMPANIES_TITLE}"
>
<f:converter converterId="BasicCompanyDataConverter" />
- <f:selectItems value="#{basicCompanyDataController.allCompanyBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+ <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
</p:selectCheckboxMenu>
</f:facet>
</p:column>
<p:column headerText="#{msg.ADMIN_ACTION_LINKS}" sortable="false" filterable="false">
- <links:outputCompanyEmployeeAdminMiniLinks employee="#{employee}" />
+ <links:outputEmployeeAdminMiniLinks employee="#{employee}" />
</p:column>
</p:dataTable>
</h:form>
styleClass="submit"
type="submit"
value="#{msg.BUTTON_ADMIN_ADD_EMPLOYEE}"
- action="#{adminEmployeeController.addCompanyEmployee()}"
+ action="#{adminEmployeeController.addEmployee()}"
update=":master:form-list-company-employees:table-list-company-employees"
/>
</p:panelGrid>