import java.io.Serializable;
/**
- * An interface for administrative branch office controller
+ * An interface for administrative department controller
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
--- /dev/null
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * 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.beans.business.department.action;
+
+import java.text.MessageFormat;
+import java.util.Objects;
+import javax.ejb.EJB;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+import javax.faces.FacesException;
+import javax.faces.application.FacesMessage;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcontacts.model.contact.Contact;
+import org.mxchange.jcontactsbusiness.events.department.added.AdminDepartmentAddedEvent;
+import org.mxchange.jcontactsbusiness.events.department.added.ObservableAdminDepartmentAddedEvent;
+import org.mxchange.jcontactsbusiness.events.department.updated.AdminDepartmentUpdatedEvent;
+import org.mxchange.jcontactsbusiness.events.department.updated.ObservableAdminDepartmentUpdatedEvent;
+import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentAlreadyAddedException;
+import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentNotFoundException;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
+import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
+import org.mxchange.jcontactsbusiness.model.department.AdminDepartmentSessionBeanRemote;
+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.headquarter.Headquarter;
+import org.mxchange.jjobs.beans.BaseJobsBean;
+import org.mxchange.jjobs.beans.business.department.list.JobsDepartmentListWebViewController;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * An administrative action bean for departments
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("adminDepartmentActionController")
+@RequestScoped
+public class JobsAdminDepartmentActionWebRequestBean extends BaseJobsBean implements JobsAdminDepartmentActionWebRequestController {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 5_028_697_360_473L;
+
+ /**
+ * EJB for administrative purposes
+ */
+ @EJB (lookup = "java:global/jjobs-ejb/adminDepartment!org.mxchange.jcontactsbusiness.model.department.AdminDepartmentSessionBeanRemote")
+ private AdminDepartmentSessionBeanRemote adminDepartmentBean;
+
+ /**
+ * Currently worked on department
+ */
+ private Department currentDepartment;
+
+ /**
+ * An event being fired when a department has been successfully added
+ */
+ @Inject
+ @Any
+ private Event<ObservableAdminDepartmentAddedEvent> departmentAddedEvent;
+
+ /**
+ * Assigned branch office (if apply-able)
+ */
+ private BranchOffice departmentBranchOffice;
+
+ /**
+ * Assigned company for this department
+ */
+ private BasicData departmentCompany;
+
+ /**
+ * Assigned headquarter (if apply-able)
+ */
+ private Headquarter departmentHeadquarter;
+
+ /**
+ * Department name
+ */
+ private String departmentI18nKey;
+
+ /**
+ * Primary key of department
+ */
+ private Long departmentId;
+
+ /**
+ * Lead person of this department
+ */
+ private Contact departmentLead;
+
+ /**
+ * A general department controller (backing bean)
+ */
+ @Inject
+ private JobsDepartmentListWebViewController departmentListController;
+
+ /**
+ * Owning user instance (which this department is assigned to)
+ */
+ private User departmentUserOwner;
+
+ /**
+ * Event being fired when a department has been updated
+ */
+ @Inject
+ @Any
+ private Event<ObservableAdminDepartmentUpdatedEvent> updatedDepartmentEvent;
+
+ /**
+ * Default constructor
+ */
+ public JobsAdminDepartmentActionWebRequestBean () {
+ // Call super constructor
+ super();
+ }
+
+ /**
+ * Adds department with all data from this backing bean. First this action
+ * method will validate if the department's address is already registered
+ * and if found, it will output a proper faces message.
+ */
+ public void addDepartment () {
+ // Get instance
+ final Department department = this.createDepartment();
+
+ // Is the department not created yet?
+ if (this.departmentListController.isDepartmentAlreadyAdded(department)) {
+ // Then show proper faces message
+ this.showFacesMessage("form-admin-add-department:branchStreet", "ADMIN_DEPARTMENT_ALREADY_CREATED", FacesMessage.SEVERITY_WARN); //NOI18N
+ return;
+ }
+
+ // Delcare updated instance
+ final Department updatedDepartment;
+
+ try {
+ // Try to call EJB
+ updatedDepartment = this.adminDepartmentBean.addDepartment(department);
+ } catch (final DepartmentAlreadyAddedException ex) {
+ // Output message
+ this.showFacesMessage("form-admin-add-department:departmentI18nKey", "ADMIN_DEPARTMENT_ALREADY_CREATED", FacesMessage.SEVERITY_ERROR); //NOI18N
+ return;
+ }
+
+ // Fire event
+ this.departmentAddedEvent.fire(new AdminDepartmentAddedEvent(updatedDepartment));
+ }
+
+ /**
+ * Copies all properties from current department to this bean.
+ */
+ public void copyAllDepartmentProperties () {
+ // Is current department set?
+ if (this.getCurrentDepartment() == null) {
+ // Throw NPE
+ throw new NullPointerException("this.currentDepartment is null"); //NOI18N
+ } else if (this.getCurrentDepartment().getDepartmentId() == null) {
+ // Throw NPE
+ throw new NullPointerException("this.currentDepartment.departmentId is null"); //NOI18N
+ } else if (this.getCurrentDepartment().getDepartmentId() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("this.currentDepartment.departmentId={0} is not valid", this.getCurrentDepartment().getDepartmentId())); //NOI18N
+ }
+
+ // Copy all fields
+ this.setDepartmentBranchOffice(this.getCurrentDepartment().getDepartmentBranchOffice());
+ this.setDepartmentCompany(this.getCurrentDepartment().getDepartmentCompany());
+ this.setDepartmentHeadquarter(this.getCurrentDepartment().getDepartmentHeadquarter());
+ this.setDepartmentI18nKey(this.getCurrentDepartment().getDepartmentI18nKey());
+ this.setDepartmentId(this.getCurrentDepartment().getDepartmentId());
+ this.setDepartmentLead(this.getCurrentDepartment().getDepartmentLead());
+ this.setDepartmentUserOwner(this.getCurrentDepartment().getDepartmentUserOwner());
+ }
+
+ /**
+ * Getter for current department
+ * <p>
+ * @return Current department
+ */
+ public Department getCurrentDepartment () {
+ return this.currentDepartment;
+ }
+
+ /**
+ * Setter for current department
+ * <p>
+ * @param currentDepartment Current department
+ */
+ public void setCurrentDepartment (final Department currentDepartment) {
+ this.currentDepartment = currentDepartment;
+ }
+
+ /**
+ * Getter for assigned branch office
+ * <p>
+ * @return Branch office
+ */
+ public BranchOffice getDepartmentBranchOffice () {
+ return this.departmentBranchOffice;
+ }
+
+ /**
+ * Setter for assigned branch office
+ * <p>
+ * @param departmentDepartment Branch office
+ */
+ public void setDepartmentBranchOffice (final BranchOffice departmentDepartment) {
+ this.departmentBranchOffice = departmentDepartment;
+ }
+
+ /**
+ * Getter for basic company data
+ * <p>
+ * @return Basic company data
+ */
+ public BasicData getDepartmentCompany () {
+ return this.departmentCompany;
+ }
+
+ /**
+ * Setter for basic company data
+ * <p>
+ * @param departmentCompany Basic company data
+ */
+ public void setDepartmentCompany (final BasicData departmentCompany) {
+ this.departmentCompany = departmentCompany;
+ }
+
+ /**
+ * Getter for assigned headquarter data
+ * <p>
+ * @return Headquarter data
+ */
+ public Headquarter getDepartmentHeadquarter () {
+ return this.departmentHeadquarter;
+ }
+
+ /**
+ * Setter for assigned headquarter data
+ * <p>
+ * @param departmentHeadquarter Headquarter data
+ */
+ public void setDepartmentHeadquarter (final Headquarter departmentHeadquarter) {
+ this.departmentHeadquarter = departmentHeadquarter;
+ }
+
+ /**
+ * Getter for department name
+ * <p>
+ * @return Department name
+ */
+ public String getDepartmentI18nKey () {
+ return this.departmentI18nKey;
+ }
+
+ /**
+ * Setter for department name
+ * <p>
+ * @param departmentI18nKey Department name
+ */
+ public void setDepartmentI18nKey (final String departmentI18nKey) {
+ this.departmentI18nKey = departmentI18nKey;
+ }
+
+ /**
+ * Getter for primary key
+ * <p>
+ * @return Primary key
+ */
+ public Long getDepartmentId () {
+ return this.departmentId;
+ }
+
+ /**
+ * Setter for primary key
+ * <p>
+ * @param departmentId Primary key
+ */
+ public void setDepartmentId (final Long departmentId) {
+ this.departmentId = departmentId;
+ }
+
+ /**
+ * Getter for department contact person
+ * <p>
+ * @return Department contact person
+ */
+ public Contact getDepartmentLead () {
+ return this.departmentLead;
+ }
+
+ /**
+ * Setter for department contact person
+ * <p>
+ * @param departmentLead Department contact person
+ */
+ public void setDepartmentLead (final Contact departmentLead) {
+ this.departmentLead = departmentLead;
+ }
+
+ /**
+ * Getter for owning user instance
+ * <p>
+ * @return Owning user instance
+ */
+ public User getDepartmentUserOwner () {
+ return this.departmentUserOwner;
+ }
+
+ /**
+ * Setter for owning user instance
+ * <p>
+ * @param departmentUserOwner Owning user instance
+ */
+ public void setDepartmentUserOwner (final User departmentUserOwner) {
+ this.departmentUserOwner = departmentUserOwner;
+ }
+
+ /**
+ * Updates department record with data from this bean.
+ * <p>
+ * @return Redirection outcome
+ */
+ public String updateDepartment () {
+ // Is current department set?
+ if (this.getCurrentDepartment() == null) {
+ // Throw NPE
+ throw new NullPointerException("this.currentDepartment is null"); //NOI18N
+ } else if (this.getCurrentDepartment().getDepartmentId() == null) {
+ // Throw NPE
+ throw new NullPointerException("this.currentDepartment.departmentId is null"); //NOI18N
+ } else if (this.getCurrentDepartment().getDepartmentId() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("this.currentDepartment.departmentId={0} is not valid", this.getCurrentDepartment().getDepartmentId())); //NOI18N
+ }
+
+ // Init instance with current data
+ final Department department = this.createDepartment();
+
+ // Does current (not updated) and just created (maybe updated) match?
+ System.out.println("this.currentDepartment.departmentLead=" + this.getCurrentDepartment().getDepartmentLead() + ",department.departmentLead=" + department.getDepartmentLead() + " - BEFORE!");
+ if (Objects.equals(this.getCurrentDepartment(), department)) {
+ // Yes, then output message
+ this.showFacesMessage("form-admin-edit-department:departmentI18nKey", "ADMIN_DEPARTMENT_NOT_UPDATED", FacesMessage.SEVERITY_WARN); //NOI18N
+
+ // Skip below code
+ return ""; //NOI18N
+ }
+
+ // Copy all fields
+ Departments.copyDepartmentData(this.getCurrentDepartment(), department);
+
+ // Initialize updated instance
+ final Department updatedDepartment;
+
+ // Try it
+ try {
+ // Invoke EJB
+ updatedDepartment = this.adminDepartmentBean.updateDepartment(department);
+ } catch (final DepartmentNotFoundException ex) {
+ // Throw as a cause
+ throw new FacesException(ex);
+ }
+
+ // Fire event
+ this.updatedDepartmentEvent.fire(new AdminDepartmentUpdatedEvent(updatedDepartment));
+
+ // Return to list view
+ return "admin_list_departments"; //NOI18N
+ }
+
+ /**
+ * Prepares an instance of a Department object (entity) with all data from
+ * this bean. If a complete fax number or land-line number was provided, it
+ * will be set in the instance as well.
+ * <p>
+ * @return An instance of a Department class (entity)
+ */
+ private Department createDepartment () {
+ // Create new department instance
+ final Department department = new BusinessDepartment(this.getDepartmentCompany(), this.getDepartmentI18nKey());
+
+ // Add all optional fields
+ department.setDepartmentBranchOffice(this.getDepartmentBranchOffice());
+ department.setDepartmentHeadquarter(this.getDepartmentHeadquarter());
+ department.setDepartmentId(this.getDepartmentId());
+ department.setDepartmentLead(this.getDepartmentLead());
+ department.setDepartmentUserOwner(this.getDepartmentUserOwner());
+
+ // Return fully prepared instance
+ return department;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * 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.beans.business.department.action;
+
+import java.io.Serializable;
+
+/**
+ * An interface for administrative action department controller
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface JobsAdminDepartmentActionWebRequestController extends Serializable {
+
+}
*/
package org.mxchange.jjobs.beans.business.department;
-import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
-import javax.enterprise.event.Event;
-import javax.enterprise.inject.Any;
-import javax.faces.application.FacesMessage;
-import javax.inject.Inject;
import javax.inject.Named;
-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.BasicData;
-import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
-import org.mxchange.jcontactsbusiness.model.department.AdminDepartmentSessionBeanRemote;
-import org.mxchange.jcontactsbusiness.model.department.BusinessDepartment;
-import org.mxchange.jcontactsbusiness.model.department.Department;
-import org.mxchange.jcontactsbusiness.model.employee.Employable;
-import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
import org.mxchange.jjobs.beans.BaseJobsBean;
-import org.mxchange.jjobs.beans.business.department.list.JobsDepartmentListWebViewController;
-import org.mxchange.jusercore.model.user.User;
/**
* An administrative bean for departments
*/
private static final long serialVersionUID = 5_028_697_360_464L;
- /**
- * EJB for administrative purposes
- */
- @EJB (lookup = "java:global/jjobs-ejb/adminDepartment!org.mxchange.jcontactsbusiness.model.department.AdminDepartmentSessionBeanRemote")
- private AdminDepartmentSessionBeanRemote adminDepartmentBean;
-
- /**
- * An event being fired when a department has been successfully added
- */
- @Inject
- @Any
- private Event<ObservableDepartmentAddedEvent> departmentAddedEvent;
-
- /**
- * Assigned branch office (if apply-able)
- */
- private BranchOffice departmentBranchOffice;
-
- /**
- * Assigned company for this department
- */
- private BasicData departmentCompany;
-
- /**
- * Assigned headquarter (if apply-able)
- */
- private Headquarter departmentHeadquarter;
-
- /**
- * Department name
- */
- private String departmentI18nKey;
-
- /**
- * Lead person of this department
- */
- private Employable departmentLead;
-
- /**
- * A general department controller (backing bean)
- */
- @Inject
- private JobsDepartmentListWebViewController departmentListController;
-
- /**
- * Owning user instance (which this department is assigned to)
- */
- private User departmentUserOwner;
-
/**
* Default constructor
*/
super();
}
- /**
- * Adds department with all data from this backing bean. First this action
- * method will validate if the department's address is already registered
- * and if found, it will output a proper faces message.
- */
- public void addDepartment () {
- // Get instance
- final Department department = this.createDepartment();
-
- // Is the department not created yet?
- if (this.departmentListController.isDepartmentAlreadyAdded(department)) {
- // Then show proper faces message
- this.showFacesMessage("form-admin-add-department:branchStreet", "ADMIN_DEPARTMENT_ALREADY_CREATED", FacesMessage.SEVERITY_WARN); //NOI18N
- return;
- }
-
- // Delcare updated instance
- final Department updatedDepartment;
-
- try {
- // Try to call EJB
- updatedDepartment = this.adminDepartmentBean.addDepartment(department);
- } catch (final DepartmentAlreadyAddedException ex) {
- // Output message
- this.showFacesMessage("form-admin-add-department:departmentI18nKey", "ADMIN_DEPARTMENT_ALREADY_CREATED", FacesMessage.SEVERITY_ERROR); //NOI18N
- return;
- }
-
- // Fire event
- this.departmentAddedEvent.fire(new DepartmentAddedEvent(updatedDepartment));
- }
-
- /**
- * Getter for assigned branch office
- * <p>
- * @return Branch office
- */
- public BranchOffice getDepartmentBranchOffice () {
- return this.departmentBranchOffice;
- }
-
- /**
- * Setter for assigned branch office
- * <p>
- * @param departmentBranchOffice Branch office
- */
- public void setDepartmentBranchOffice (final BranchOffice departmentBranchOffice) {
- this.departmentBranchOffice = departmentBranchOffice;
- }
-
- /**
- * Getter for basic company data
- * <p>
- * @return Basic company data
- */
- public BasicData getDepartmentCompany () {
- return this.departmentCompany;
- }
-
- /**
- * Setter for basic company data
- * <p>
- * @param departmentCompany Basic company data
- */
- public void setDepartmentCompany (final BasicData departmentCompany) {
- this.departmentCompany = departmentCompany;
- }
-
- /**
- * Getter for assigned headquarter data
- * <p>
- * @return Headquarter data
- */
- public Headquarter getDepartmentHeadquarter () {
- return this.departmentHeadquarter;
- }
-
- /**
- * Setter for assigned headquarter data
- * <p>
- * @param departmentHeadquarter Headquarter data
- */
- public void setDepartmentHeadquarter (final Headquarter departmentHeadquarter) {
- this.departmentHeadquarter = departmentHeadquarter;
- }
-
- /**
- * Getter for department name
- * <p>
- * @return Department name
- */
- public String getDepartmentI18nKey () {
- return this.departmentI18nKey;
- }
-
- /**
- * Setter for department name
- * <p>
- * @param departmentI18nKey Department name
- */
- public void setDepartmentI18nKey (final String departmentI18nKey) {
- this.departmentI18nKey = departmentI18nKey;
- }
-
- /**
- * Getter for department contact person
- * <p>
- * @return Department contact person
- */
- public Employable getDepartmentLead () {
- return this.departmentLead;
- }
-
- /**
- * Setter for department contact person
- * <p>
- * @param departmentLead Department contact person
- */
- public void setDepartmentLead (final Employable departmentLead) {
- this.departmentLead = departmentLead;
- }
-
- /**
- * Getter for owning user instance
- * <p>
- * @return Owning user instance
- */
- public User getDepartmentUserOwner () {
- return this.departmentUserOwner;
- }
-
- /**
- * Setter for owning user instance
- * <p>
- * @param departmentUserOwner Owning user instance
- */
- public void setDepartmentUserOwner (final User departmentUserOwner) {
- this.departmentUserOwner = departmentUserOwner;
- }
-
- /**
- * Prepares an instance of a Department object (entity) with all data from
- * this bean. If a complete fax number or land-line number was provided, it
- * will be set in the instance as well.
- * <p>
- * @return An instance of a Department class (entity)
- */
- private Department createDepartment () {
- // Create new department instance
- final Department department = new BusinessDepartment(this.getDepartmentCompany(), this.getDepartmentI18nKey());
-
- // Add all optional fields
- department.setDepartmentHeadquarter(this.getDepartmentHeadquarter());
- department.setDepartmentBranchOffice(this.getDepartmentBranchOffice());
- department.setDepartmentLead(this.getDepartmentLead());
- department.setDepartmentUserOwner(this.getDepartmentUserOwner());
-
- // Return fully prepared instance
- return department;
- }
-
}
import javax.faces.application.FacesMessage;
import javax.inject.Inject;
import javax.inject.Named;
+import org.mxchange.jcontacts.model.contact.Contact;
import org.mxchange.jcontactsbusiness.events.branchoffice.added.AdminBranchOfficeAddedEvent;
import org.mxchange.jcontactsbusiness.events.branchoffice.added.ObservableAdminBranchOfficeAddedEvent;
import org.mxchange.jcontactsbusiness.events.branchoffice.updated.AdminBranchOfficeUpdatedEvent;
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffices;
import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice;
-import org.mxchange.jcontactsbusiness.model.employee.Employable;
import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
import org.mxchange.jcoreee.dates.DayOfTheWeek;
/**
* Contact person in branch office
*/
- private Employable branchContactEmployee;
+ private Contact branchContactEmployee;
/**
* Country
/**
* Owner/leader of branch office
*/
- private Employable branchOwnerEmployee;
+ private Contact branchOwnerEmployee;
/**
* Store
* <p>
* @return Branch office contact person
*/
- public Employable getBranchContactEmployee () {
+ public Contact getBranchContactEmployee () {
return this.branchContactEmployee;
}
* <p>
* @param branchContactEmployee Branch office contact person
*/
- public void setBranchContactEmployee (final Employable branchContactEmployee) {
+ public void setBranchContactEmployee (final Contact branchContactEmployee) {
this.branchContactEmployee = branchContactEmployee;
}
* <p>
* @return Branch office contact person
*/
- public Employable getBranchOwnerEmployee () {
+ public Contact getBranchOwnerEmployee () {
return this.branchOwnerEmployee;
}
* <p>
* @param branchOwnerEmployee Branch office contact person
*/
- public void setBranchOwnerEmployee (final Employable branchOwnerEmployee) {
+ public void setBranchOwnerEmployee (final Contact branchOwnerEmployee) {
this.branchOwnerEmployee = branchOwnerEmployee;
}
* @return Redirection outcome
*/
public String updateBranchOffice () {
- // Id should be set
- if (this.getBranchId() == null) {
+ // Validate current product instance and id
+ if (this.getCurrentBranchOffice() == null) {
+ // Throw NPE
+ throw new NullPointerException("this.product is null"); //NOI18N
+ } else if (this.getCurrentBranchOffice().getBranchId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("this.product.branchId is null"); //NOI18N
+ } else if (this.getCurrentBranchOffice().getBranchId() < 1) {
+ // Not valid
+ throw new IllegalStateException(MessageFormat.format("this.product.branchId={0} is not valid.", this.getCurrentBranchOffice().getBranchId())); //NOI18N
+ } else if (this.getBranchId() == null) {
// Throw NPE
throw new NullPointerException("this.branchId is null"); //NOI18N
} else if (this.getBranchId() < 1) {
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
-import org.mxchange.jcontactsbusiness.events.department.added.ObservableDepartmentAddedEvent;
+import org.mxchange.jcontactsbusiness.events.department.added.ObservableAdminDepartmentAddedEvent;
import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentNotFoundException;
import org.mxchange.jcontactsbusiness.model.department.Department;
import org.mxchange.jcontactsbusiness.model.department.DepartmentSessionBeanRemote;
* null
* @throws IllegalArgumentException If the branchId is zero or lower
*/
- public void afterDepartmentAddedEvent (@Observes final ObservableDepartmentAddedEvent event) {
+ public void afterDepartmentAddedEvent (@Observes final ObservableAdminDepartmentAddedEvent event) {
// Validate parameter
if (null == event) {
// Throw NPE
throw new NullPointerException("event is null"); //NOI18N
- } else if (event.getDepartment() == null) {
+ } else if (event.getAddedDepartment() == null) {
// Throw NPE again
throw new NullPointerException("event.department is null"); //NOI18N
- } else if (event.getDepartment().getDepartmentId() == null) {
+ } else if (event.getAddedDepartment().getDepartmentId() == null) {
// Throw it again
throw new NullPointerException("event.department.branchId is null"); //NOI18N
- } else if (event.getDepartment().getDepartmentId() < 1) {
+ } else if (event.getAddedDepartment().getDepartmentId() < 1) {
// Throw IAE
- throw new IllegalArgumentException(MessageFormat.format("event.department.branchId={0} is not valid", event.getDepartment().getDepartmentId())); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("event.department.branchId={0} is not valid", event.getAddedDepartment().getDepartmentId())); //NOI18N
}
// Add instance to cache
- this.departmentCache.put(event.getDepartment().getDepartmentId(), event.getDepartment());
- this.getAllDepartments().add(event.getDepartment());
+ this.departmentCache.put(event.getAddedDepartment().getDepartmentId(), event.getAddedDepartment());
+ this.getAllDepartments().add(event.getAddedDepartment());
}
@Override
import javax.faces.application.FacesMessage;
import javax.inject.Inject;
import javax.inject.Named;
+import org.mxchange.jcontacts.model.contact.Contact;
import org.mxchange.jcontactsbusiness.events.headquarter.added.HeadquarterAddedEvent;
import org.mxchange.jcontactsbusiness.events.headquarter.added.ObservableHeadquarterAddedEvent;
import org.mxchange.jcontactsbusiness.exceptions.headquarter.HeadquarterAlreadyAddedException;
-import org.mxchange.jcontactsbusiness.model.employee.Employable;
import org.mxchange.jcontactsbusiness.model.headquarter.AdminHeadquarterSessionBeanRemote;
import org.mxchange.jcontactsbusiness.model.headquarter.BusinessHeadquarter;
import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
/**
* Contact person in headquarter
*/
- private Employable headquarterContactEmployee;
+ private Contact headquarterContactEmployee;
/**
* Country
* <p>
* @return Headquarter contact person
*/
- public Employable getHeadquarterContactEmployee () {
+ public Contact getHeadquarterContactEmployee () {
return this.headquarterContactEmployee;
}
* <p>
* @param headquarterContactEmployee Headquarter contact person
*/
- public void setHeadquarterContactEmployee (final Employable headquarterContactEmployee) {
+ public void setHeadquarterContactEmployee (final Contact headquarterContactEmployee) {
this.headquarterContactEmployee = headquarterContactEmployee;
}
throw new NullPointerException("event is null"); //NOI18N
} else if (event.getCreatedContact() == null) {
// Throw NPE again
- throw new NullPointerException("event.createdContact is null"); //NOI18N //NOI18N
+ throw new NullPointerException("event.createdContact is null"); //NOI18N
} else if (event.getCreatedContact().getContactId() == null) {
// Throw NPE again
- throw new NullPointerException("event.createdContact.contactId is null"); //NOI18N //NOI18N
+ throw new NullPointerException("event.createdContact.contactId is null"); //NOI18N
} else if (event.getCreatedContact().getContactId() < 1) {
// Not valid
throw new IllegalStateException(MessageFormat.format("event.createdContact.contactId={0} is not valid.", event.getCreatedContact().getContactId())); //NOI18N
throw new NullPointerException("beanHelper.contact is null"); //NOI18N
} else if (createdContact.getContactId() == null) {
// Throw NPE again
- throw new NullPointerException("beanHelper.contact.contactId is null"); //NOI18N //NOI18N
+ throw new NullPointerException("beanHelper.contact.contactId is null"); //NOI18N
} else if (createdContact.getContactId() < 1) {
// Invalid id
throw new IllegalStateException(MessageFormat.format("beanHelper.contact.contactId={0} is invalid", createdContact.getContactId())); //NOI18N
throw new NullPointerException("contact is null"); //NOI18N
} else if (contact.getContactId() == null) {
// Throw NPE again
- throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
+ throw new NullPointerException("contact.contactId is null"); //NOI18N
} else if (contact.getContactId() < 1) {
// Invalid id
throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
throw new NullPointerException("event.addedContact.contactId is null"); //NOI18N
} else if (event.getAddedContact().getContactId() < 1) {
// Not valid
- throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N
}
// Call other method
throw new NullPointerException("event is null"); //NOI18N
} else if (event.getCreatedContact() == null) {
// Throw NPE again
- throw new NullPointerException("event.createdContact is null"); //NOI18N //NOI18N
+ throw new NullPointerException("event.createdContact is null"); //NOI18N
} else if (event.getCreatedContact().getContactId() == null) {
// Throw NPE again
- throw new NullPointerException("event.createdContact.contactId is null"); //NOI18N //NOI18N
+ throw new NullPointerException("event.createdContact.contactId is null"); //NOI18N
} else if (event.getCreatedContact().getContactId() < 1) {
// Not valid
throw new IllegalStateException(MessageFormat.format("event.createdContact.contactId={0} is not valid.", event.getCreatedContact().getContactId())); //NOI18N
throw new NullPointerException("event is null"); //NOI18N
} else if (event.getCreatedContact() == null) {
// Throw NPE again
- throw new NullPointerException("event.createdContact is null"); //NOI18N //NOI18N
+ throw new NullPointerException("event.createdContact is null"); //NOI18N
} else if (event.getCreatedContact().getContactId() == null) {
// Throw NPE again
- throw new NullPointerException("event.createdContact.contactId is null"); //NOI18N //NOI18N
+ throw new NullPointerException("event.createdContact.contactId is null"); //NOI18N
} else if (event.getCreatedContact().getContactId() < 1) {
// Not valid
throw new IllegalStateException(MessageFormat.format("event.createdContact.contactId={0} is not valid.", event.getCreatedContact().getContactId())); //NOI18N
ADMIN_LINK_LIST_COUNTRIES=L\u00e4nder
ADMIN_LINK_LIST_COUNTRIES_TITLE=Bestehende L\u00e4nderdaten auflisten, neue hinzuf\u00fcgen, \u00e4ndern und l\u00f6schen.
PAGE_TITLE_ADMIN_LIST_COUNTRY=L\u00e4nderdaten auflisten
-#@TODO Please fix German umlauts!
-CONTENT_TITLE_ADMIN_LIST_COUNTRY=Auflisten von Laenderdaten:
+CONTENT_TITLE_ADMIN_LIST_COUNTRY=Auflisten von L\u00e4nderdaten:
ADMIN_ADD_COUNTRY_TITLE=Neues Land hinzuf\u00fcgen
ADMIN_COUNTRY_DATA_MINIMUM_NOTICE=Bitte geben Sie alle Felder an.
ADMIN_ADD_COUNTRY_I18N_KEY_NOTICE=Der Schl\u00fcssel f\u00fcr das Sprachpaket ist in Grossbuchstaben und Unterstrichen zu schreiben. Beispiel: COUNTRY_GERMANY f\u00fcr Deutschland
#@TODO Please fix German umlauts!
ADMIN_LINK_DELETE_MOBILE_PROVIDER_TITLE=Loescht den Mobilfunkanbieter.
ADMIN_LINK_SHOW_COUNTRY_TITLE=Zeigt Details des Landes an.
+ADMIN_LINK_EDIT_COUNTRY_TITLE=Editieren der L\u00e4nderdaten.
#@TODO Please fix German umlauts!
-ADMIN_LINK_EDIT_COUNTRY_TITLE=Editieren der Laenderdaten.
-#@TODO Please fix German umlauts!
-ADMIN_LINK_DELETE_COUNTRY_TITLE=Loescht die Laenderdaten.
+ADMIN_LINK_DELETE_COUNTRY_TITLE=Loescht die L\u00e4nderdaten.
#@TODO Please fix German umlauts!
-ADMIN_EMPTY_LIST_COUNTRY=Es befinden sich keine Laender in der Datenbank. Oder Ihre Suche ergab keine Uebereinstimmungen.
+ADMIN_EMPTY_LIST_COUNTRY=Es befinden sich keine L\u00e4nder in der Datenbank. Oder Ihre Suche ergab keine Uebereinstimmungen.
#@TODO Please fix German umlauts!
ADMIN_EMPTY_LIST_FAX_NUMBER=Es befinden sich keine Faxnummern in der Datenbank oder Ihre Suche ergab keine Uebereinstimmungen.
#@TODO Please fix German umlauts!
ADMIN_EMPTY_LIST_CONTACT_MOBILE=Es befinden sich keine Mobilfunknummern von Kontakten in der Datenbank oder Ihre Suche ergab keine Uebereinstimmungen.
#@TODO Please fix German umlauts!
ADMIN_MOBILE_PROVIDER_COUNTRY_REQUIRED=Bitte waehlen Sie ein Land f\u00fcr den Mobilfunkanbieter aus.
-#@TODO Please fix German umlauts!
-LABEL_COUNTRIES=Laender
-#@TODO Please fix German umlauts!
-FILTER_BY_MULTIPLE_COUNTRY_TITLE=Liste durch Auswahl von ein oder mehr Laendern durchsuchen.
+LABEL_COUNTRIES=L\u00e4nder
+FILTER_BY_MULTIPLE_COUNTRY_TITLE=Liste durch Auswahl von ein oder mehr L\u00e4ndern durchsuchen.
ADMIN_LIST_MOBILE_PROVIDERS_HEADER=Liste aller Mobilfunkanbieter
SELECT_SHOWN_COLUMNS=Angezeigte Spalten
ADMIN_LIST_BRANCH_OFFICES_HEADER=Alle Filialen auflisten
ADMIN_EDIT_BRANCH_OFFICE_TITLE=Filiale mit Id-Nummer {0} editieren:
ADMIN_EDIT_BRANCH_OFFICE_NUMBER_TITLE=Filiale Nummer {1} (Id {0}) editieren:
BUTTON_ADMIN_EDIT_BRANCH_OFFICE=Filiale \u00e4ndern
+ERROR_PARAMETER_DEPARTMENT_ID_NOT_SET=Fehler: Parameter "departmentId" ist nicht gesetzt.
+PARAMETER_DEPARTMENT_ID_INVALID=Unter der angegebenen Id-Nummer konnte keine Abteilung gefunden werden..
+PAGE_TITLE_ADMIN_EDIT_DEPARTMENT=Abteilung editieren
+CONTENT_TITLE_ADMIN_EDIT_DEPARTMENT=Abteilung editieren:
+ADMIN_EDIT_DEPARTMENT_TITLE=Editing department {0} (Id {1}):
+#@TODO Please fix German umlauts!
+ADMIN_DEPARTMENT_MINIMUM_DATA=Bitte geben Sie mindestens den Internationalisierungsschlussel ein, waehlen Sie ein Unternehmen aus und entweder eine Filiale oder einen Hauptsitz als mindest benoetigte Daten aus.
+BUTTON_ADMIN_EDIT_DEPARTMENT=Abteilung \u00e4ndern
+#@TODO Please fix German umlauts!
+ADMIN_DEPARTMENT_NOT_UPDATED=Sie haben keine Daten der Filiale geaendert.
ADMIN_EDIT_BRANCH_OFFICE_TITLE=Edit branch office with id {0}:
ADMIN_EDIT_BRANCH_OFFICE_NUMBER_TITLE=Edit branch office number {1} (Id {0}):
BUTTON_ADMIN_EDIT_BRANCH_OFFICE=Change branch office
+ERROR_PARAMETER_DEPARTMENT_ID_NOT_SET=Error: Parameter "departmentId" is not set.
+PARAMETER_DEPARTMENT_ID_INVALID=No depatment could be found by provided id number.
+PAGE_TITLE_ADMIN_EDIT_DEPARTMENT=Edit department
+CONTENT_TITLE_ADMIN_EDIT_DEPARTMENT=Edit department:
+ADMIN_EDIT_DEPARTMENT_TITLE=Editing department {0} (Id {1}):
+ADMIN_DEPARTMENT_MINIMUM_DATA=Please entet at least an i18n string, selecct a company and either select a branch office or a headquarter as minimum required data.
+BUTTON_ADMIN_EDIT_DEPARTMENT=Change department
+ADMIN_DEPARTMENT_NOT_UPDATED=You have not changed any data of the department.
<to-view-id>/admin/opening_time/admin_opening_time_list.xhtml</to-view-id>
</navigation-case>
<navigation-case>
- <from-outcome>admin_list_company_employee</from-outcome>
+ <from-outcome>admin_list_employee</from-outcome>
<to-view-id>/admin/employee/admin_employee_list.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<to-view-id>/admin/basic_data/admin_basic_data_assign_owner.xhtml</to-view-id>
</navigation-case>
<navigation-case>
- <from-outcome>admin_show_employee</from-outcome>
- <to-view-id>/admin/company_employee/admin_company_employee_show.xhtml</to-view-id>
+ <from-outcome>admin_show_contact</from-outcome>
+ <to-view-id>/admin/contact/admin_contact_show.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>admin_assign_basic_data_employee</from-outcome>
<to-view-id>/admin/headquarter/admin_headquarter_assign_owner.xhtml</to-view-id>
</navigation-case>
<navigation-case>
- <from-outcome>admin_show_employee</from-outcome>
- <to-view-id>/admin/company_employee/admin_company_employee_show.xhtml</to-view-id>
+ <from-outcome>admin_show_contact</from-outcome>
+ <to-view-id>/admin/contact/admin_contact_show.xhtml</to-view-id>
</navigation-case>
<navigation-case>
- <from-outcome>admin_assign_headquarter_employee</from-outcome>
- <to-view-id>/admin/headquarter/admin_headquarter_assign_employee.xhtml</to-view-id>
+ <from-outcome>admin_assign_headquarter_contact</from-outcome>
+ <to-view-id>/admin/headquarter/admin_headquarter_assign_contact.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<to-view-id>/admin/basic_data/admin_basic_data_show.xhtml</to-view-id>
</navigation-case>
<navigation-case>
- <from-outcome>admin_show_employee</from-outcome>
- <to-view-id>/admin/company_employee/admin_company_employee_show.xhtml</to-view-id>
+ <from-outcome>admin_show_contact</from-outcome>
+ <to-view-id>/admin/contact/admin_contact_show.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>admin_assign_branch_office_employee</from-outcome>
<to-view-id>/admin/department/admin_assign_department_branch_office.xhtml</to-view-id>
</navigation-case>
<navigation-case>
- <from-outcome>admin_show_employee</from-outcome>
- <to-view-id>/admin/employee/admin_employee_show.xhtml</to-view-id>
+ <from-outcome>admin_show_contact</from-outcome>
+ <to-view-id>/admin/contact/admin_contact_show.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>admin_assign_department_employee</from-outcome>
<to-view-id>/admin/department/admin_assign_department_user.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
+ <navigation-rule>
+ <from-view-id>/admin/department/admin_department_edit.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>admin_list_departments</from-outcome>
+ <to-view-id>/admin/department/admin_department_list.xhtml</to-view-id>
+ <redirect></redirect>
+ </navigation-case>
+ </navigation-rule>
<navigation-rule>
<from-view-id>/admin/employee/admin_employee_list.xhtml</from-view-id>
<navigation-case>
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
>
-
- <!--
- @TODO title="#{msg.ADMIN_CONTACT_PERSONAL_DATA_LEGEND_TITLE}"
- -->
- <p:fieldset legend="#{msg.ADMIN_CONTACT_PERSONAL_DATA_LEGEND}" rendered="#{empty rendered or rendered}">
+ <p:fieldset
+ legend="#{msg.ADMIN_CONTACT_PERSONAL_DATA_LEGEND}"
+ title="#{msg.ADMIN_CONTACT_PERSONAL_DATA_LEGEND_TITLE}"
+ rendered="#{empty rendered or rendered}"
+ >
<p:panelGrid
layout="grid"
columns="2"
xmlns:p="http://primefaces.org/ui"
>
- <!--
- @TODO title="#{msg.ADMIN_USER_DATA_EMAIL_LEGEND_TITLE}"
- -->
- <ui:fragment rendered="#{not empty mode}">
- <p:fieldset legend="#{msg.ADMIN_USER_DATA_EMAIL_LEGEND}">
- <p:panelGrid
- columns="2"
- columnClasses="ui-grid-col-4,ui-grid-col-8"
- styleClass="ui-noborder"
- >
- <p:outputLabel for="userName" value="#{msg.ADMIN_PERSONAL_DATA_ENTER_USER_NAME}" />
- <p:inputText id="userName" size="20" maxlength="255" value="#{adminUserController.userName}" required="true" requiredMessage="#{msg.ADMIN_USER_NAME_IS_REQUIRED}" />
+ <p:fieldset
+ legend="#{msg.ADMIN_USER_DATA_EMAIL_LEGEND}"
+ title="#{msg.ADMIN_USER_DATA_EMAIL_LEGEND_TITLE}"
+ rendered="#{not empty mode}"
+ >
+ <p:panelGrid
+ columns="2"
+ columnClasses="ui-grid-col-4,ui-grid-col-8"
+ styleClass="ui-noborder"
+ >
+ <p:outputLabel for="userName" value="#{msg.ADMIN_PERSONAL_DATA_ENTER_USER_NAME}" />
+ <p:inputText id="userName" size="20" maxlength="255" value="#{adminUserController.userName}" required="true" requiredMessage="#{msg.ADMIN_USER_NAME_IS_REQUIRED}" />
- <p:outputLabel for="userPassword" value="#{msg.ADMIN_USER_DATA_ENTER_PASSWORD}" />
- <p:inputText type="password" id="userPassword" size="10" maxlength="255" value="#{adminUserController.userPassword}" />
+ <p:outputLabel for="userPassword" value="#{msg.ADMIN_USER_DATA_ENTER_PASSWORD}" />
+ <p:inputText type="password" id="userPassword" size="10" maxlength="255" value="#{adminUserController.userPassword}" />
- <p:outputLabel for="userPasswordRepeat" value="#{msg.ADMIN_USER_DATA_ENTER_PASSWORD_REPEAT}" />
- <p:inputText type="password" id="userPasswordRepeat" size="10" maxlength="255" value="#{adminUserController.userPasswordRepeat}" />
+ <p:outputLabel for="userPasswordRepeat" value="#{msg.ADMIN_USER_DATA_ENTER_PASSWORD_REPEAT}" />
+ <p:inputText type="password" id="userPasswordRepeat" size="10" maxlength="255" value="#{adminUserController.userPasswordRepeat}" />
- <p:outputLabel for="userMustChangePassword" value="#{msg.ADMIN_USER_MUST_CHANGE_PASSWORD}" />
- <p:selectBooleanCheckbox id="userMustChangePassword" value="#{adminUserController.userMustChangePassword}" />
+ <p:outputLabel for="userMustChangePassword" value="#{msg.ADMIN_USER_MUST_CHANGE_PASSWORD}" />
+ <p:selectBooleanCheckbox id="userMustChangePassword" value="#{adminUserController.userMustChangePassword}" />
- <p:outputLabel for="userProfileMode" value="#{msg.ADMIN_SELECT_USER_PROFILE_MODE}" />
- <p:selectOneMenu
- id="userProfileMode"
- value="#{adminUserController.userProfileMode}"
- filter="true"
- filterMatchMode="contains"
- >
+ <p:outputLabel for="userProfileMode" value="#{msg.ADMIN_SELECT_USER_PROFILE_MODE}" />
+ <p:selectOneMenu
+ id="userProfileMode"
+ value="#{adminUserController.userProfileMode}"
+ filter="true"
+ filterMatchMode="contains"
+ >
- <f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
+ <f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
- <f:selectItems
- value="#{dataController.profileModes}"
- var="profileMode"
- itemValue="#{profileMode}"
- itemLabel="#{msg[profileMode.messageKey]}"
- />
- </p:selectOneMenu>
- </p:panelGrid>
- </p:fieldset>
+ <f:selectItems
+ value="#{dataController.profileModes}"
+ var="profileMode"
+ itemValue="#{profileMode}"
+ itemLabel="#{msg[profileMode.messageKey]}"
+ />
+ </p:selectOneMenu>
+ </p:panelGrid>
+ </p:fieldset>
- <h:panelGroup styleClass="para notice" layout="block">
- <ul>
- <li><h:outputText value="#{msg.ADMIN_USER_DATA_USER_NAME_NOTICE}" /></li>
+ <p:fieldset
+ legend="#{msg.ADMIN_USER_DATA_NOTICES_LEGEND}"
+ rendered="#{not empty mode}"
+ >
+ <ul>
+ <li><h:outputText value="#{msg.ADMIN_USER_DATA_USER_NAME_NOTICE}" /></li>
- <li>
- <h:outputText value="#{msg.ADMIN_USER_DATA_PASSWORD_EDIT_NOTICE}" rendered="#{mode == 'edit'}" />
- <h:outputText value="#{msg.ADMIN_USER_DATA_PASSWORD_ADD_NOTICE}" rendered="#{mode == 'add'}" />
- </li>
- </ul>
- </h:panelGroup>
- </ui:fragment>
+ <li>
+ <h:outputText value="#{msg.ADMIN_USER_DATA_PASSWORD_EDIT_NOTICE}" rendered="#{mode == 'edit'}" />
+ <h:outputText value="#{msg.ADMIN_USER_DATA_PASSWORD_ADD_NOTICE}" rendered="#{mode == 'add'}" />
+ </li>
+ </ul>
+ </p:fieldset>
</ui:composition>
filterMatchMode="contains"
>
- <f:converter converterId="EmployeeConverter" />
+ <f:converter converterId="ContactConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
<f:selectItems
- value="#{employeeListController.allEmployees}"
- var="companyEmployee"
- itemValue="#{companyEmployee}"
- itemLabel="#{beanHelper.renderEmployee(companyEmployee, false)}"
+ value="#{contactListController.allContacts}"
+ var="contact"
+ itemValue="#{contact}"
+ itemLabel="#{beanHelper.renderContact(contact)}"
/>
</p:selectOneMenu>
filterMatchMode="contains"
>
- <f:converter converterId="EmployeeConverter" />
+ <f:converter converterId="ContactConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
<f:selectItems
- value="#{employeeListController.allEmployees}"
- var="companyEmployee"
- itemValue="#{companyEmployee}"
- itemLabel="#{beanHelper.renderEmployee(companyEmployee, false)}"
+ value="#{contactListController.allContacts}"
+ var="contact"
+ itemValue="#{contact}"
+ itemLabel="#{beanHelper.renderContact(contact)}"
/>
</p:selectOneMenu>
<p:inputText
id="departmentI18nKey"
maxlength="255"
- value="#{adminDepartmentController.departmentI18nKey}"
+ value="#{adminDepartmentActionController.departmentI18nKey}"
required="true"
requiredMessage="#{msg.ADMIN_DEPARTMENT_I18N_KEY_REQUIRED}"
/>
<p:outputLabel for="departmentCompany" value="#{msg.ADMIN_ASSIGN_DEPARTMENT_COMPANY}" />
<p:selectOneMenu
id="departmentCompany"
- value="#{adminDepartmentController.departmentCompany}"
+ value="#{adminDepartmentActionController.departmentCompany}"
filter="true"
filterMatchMode="contains"
required="true"
<p:outputLabel for="departmentBranchOffice" value="#{msg.ADMIN_ASSIGN_DEPARTMENT_BRANCH_OFFICE}" />
<p:selectOneMenu
id="departmentBranchOffice"
- value="#{adminDepartmentController.departmentBranchOffice}"
+ value="#{adminDepartmentActionController.departmentBranchOffice}"
filter="true"
filterMatchMode="contains"
>
<p:outputLabel for="departmentHeadquarter" value="#{msg.ADMIN_ASSIGN_DEPARTMENT_HEADQUARTER}" />
<p:selectOneMenu
id="departmentHeadquarter"
- value="#{adminDepartmentController.departmentHeadquarter}"
+ value="#{adminDepartmentActionController.departmentHeadquarter}"
filter="true"
filterMatchMode="contains"
>
<p:outputLabel for="departmentLead" value="#{msg.ADMIN_ASSIGN_DEPARTMENT_LEAD_EMPLOYEE}" />
<p:selectOneMenu
id="departmentLead"
- value="#{adminDepartmentController.departmentLead}"
+ value="#{adminDepartmentActionController.departmentLead}"
filter="true"
filterMatchMode="contains"
>
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
<f:selectItems
- value="#{employeeListController.allEmployees}"
- var="employee"
- itemValue="#{employee}"
- itemLabel="#{beanHelper.renderEmployee(employee, false)}"
+ value="#{contactListController.allContacts}"
+ var="contact"
+ itemValue="#{contact}"
+ itemLabel="#{beanHelper.renderContact(contact)}"
/>
</p:selectOneMenu>
<p:outputLabel for="departmentUserOwner" value="#{msg.ADMIN_ASSIGN_DEPARTMENT_USER_OWNER}" />
<p:selectOneMenu
id="departmentUserOwner"
- value="#{adminDepartmentController.departmentUserOwner}"
+ value="#{adminDepartmentActionController.departmentUserOwner}"
filter="true"
filterMatchMode="contains"
>
<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-@TODO title="#{msg.ADMIN_EMPLOYEE_GENERAL_LEGEND_TITLE}"
--->
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:core="http://mxchange.org/jsf/core/widgets"
xmlns:p="http://primefaces.org/ui"
>
- <p:fieldset legend="#{msg.ADMIN_EMPLOYEE_GENERAL_LEGEND}">
+ <p:fieldset
+ legend="#{msg.ADMIN_EMPLOYEE_GENERAL_LEGEND}"
+ title="#{msg.ADMIN_EMPLOYEE_GENERAL_LEGEND_TITLE}"
+ >
<p:panelGrid
layout="grid"
columns="2"
</p:panelGrid>
</p:fieldset>
- <!--
- @TODO title="#{msg.ADMIN_EMPLOYEE_OTHER_LEGEND_TITLE}"
- -->
- <p:fieldset legend="#{msg.ADMIN_EMPLOYEE_OTHER_LEGEND}">
+ <p:fieldset
+ legend="#{msg.ADMIN_EMPLOYEE_OTHER_LEGEND}"
+ title="#{msg.ADMIN_EMPLOYEE_OTHER_LEGEND_TITLE}"
+ >
<p:panelGrid
layout="grid"
columns="2"
filterMatchMode="contains"
>
- <f:converter converterId="EmployeeConverter" />
+ <f:converter converterId="ContactConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
<f:selectItems
- value="#{employeeListController.allEmployees}"
- var="companyEmployee"
- itemValue="#{companyEmployee}"
- itemLabel="#{beanHelper.renderEmployee(companyEmployee, false)}"
+ value="#{contactListController.allContacts}"
+ var="contact"
+ itemValue="#{contact}"
+ itemLabel="#{beanHelper.renderContact(contact)}"
/>
</p:selectOneMenu>
updateLabel="true"
title="#{msg.FILTER_BY_MULTIPLE_EMPLOYEES_TITLE}"
>
- <f:converter converterId="EmployeeConverter" />
+ <f:converter converterId="ContactConverter" />
<f:selectItems
- value="#{employeeListController.allEmployees}"
- var="employee"
- itemValue="#{employee}"
- itemLabel="#{beanHelper.renderEmployee(employee, false)}"
+ value="#{contactListController.allContacts}"
+ var="contact"
+ itemValue="#{contact}"
+ itemLabel="#{beanHelper.renderContact(contact)}"
/>
</p:selectCheckboxMenu>
</f:facet>
<p:link
- outcome="admin_show_employee"
- value="#{beanHelper.renderEmployee(branchOffice.branchContactEmployee, false)}"
+ outcome="admin_show_contact"
+ value="#{beanHelper.renderContact(branchOffice.branchContactEmployee)}"
title="#{msg.ADMIN_LINK_SHOW_BRANCH_OFFICE_CONTACT_PERSON_TITLE}"
rendered="#{not empty branchOffice.branchContactEmployee}"
>
- <f:param name="employeeId" value="#{branchOffice.branchContactEmployee.employeeId}" />
+ <f:param name="contactId" value="#{branchOffice.branchContactEmployee.contactId}" />
</p:link>
<p:link
- outcome="admin_assign_branch_office_employee"
+ outcome="admin_assign_branch_office_contact"
value="#{msg.ADMIN_LINK_ASSIGN}"
title="#{msg.ADMIN_LINK_ASSIGN_BRANCH_OFFICES_CONTACT_PERSON_TITLE}"
rendered="#{empty branchOffice.branchContactEmployee}"
<p:outputLabel value="#{msg.ASSIGNED_CONTACT_PERSON_HEADER}" title="#{msg.ASSIGNED_CONTACT_PERSON_TO_BRANCH_OFFICE_TITLE}" />
<p:link
- outcome="admin_show_employee"
+ outcome="admin_show_contact"
target="_blank"
- value="#{beanHelper.renderEmployee(branchOfficeListController.selectedBranchOffice.branchContactEmployee, true)}"
+ value="#{beanHelper.renderContact(branchOfficeListController.selectedBranchOffice.branchContactEmployee)}"
title="#{msg.ADMIN_LINK_SHOW_BRANCH_OFFICE_CONTACT_PERSON_TITLE}"
rendered="#{not empty branchOfficeListController.selectedBranchOffice.branchContactEmployee}"
>
- <f:param name="employeeId" value="#{branchOfficeListController.selectedBranchOffice.branchContactEmployee.employeeId}" />
+ <f:param name="contactId" value="#{branchOfficeListController.selectedBranchOffice.branchContactEmployee.contactId}" />
</p:link>
<h:outputText value="#{msg.NO_CONTACT_EMPLOYEE_ASSIGNED_TO_BRANCH_OFFICE}" rendered="#{empty branchOfficeListController.selectedBranchOffice.branchContactEmployee}" />
<p:outputLabel value="#{msg.ASSIGNED_OWNER_EMPLOYEE_HEADER}" title="#{msg.ASSIGNED_OWNER_EMPLOYEE_TO_BRANCH_OFFICE_TITLE}" />
<p:link
- outcome="admin_show_employee"
+ outcome="admin_show_contact"
target="_blank"
- value="#{beanHelper.renderEmployee(branchOfficeListController.selectedBranchOffice.branchOwnerEmployee, true)}"
+ value="#{beanHelper.renderContact(branchOfficeListController.selectedBranchOffice.branchOwnerEmployee)}"
title="#{msg.ADMIN_LINK_SHOW_BRANCH_OFFICE_OWNER_EMPLOYEE_TITLE}"
rendered="#{not empty branchOfficeListController.selectedBranchOffice.branchOwnerEmployee}"
>
- <f:param name="employeeId" value="#{branchOfficeListController.selectedBranchOffice.branchContactEmployee.employeeId}" />
+ <f:param name="contactId" value="#{branchOfficeListController.selectedBranchOffice.branchContactEmployee.contactId}" />
</p:link>
<h:outputText value="#{msg.NO_OWNER_EMPLOYEE_ASSIGNED_TO_BRANCH_OFFICE}" rendered="#{empty branchOfficeListController.selectedBranchOffice.branchOwnerEmployee}" />
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<ui:composition
+ template="/WEB-INF/templates/admin/admin_base.tpl"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+ xmlns:h="http://xmlns.jcp.org/jsf/html"
+ xmlns:f="http://xmlns.jcp.org/jsf/core"
+ xmlns:p="http://primefaces.org/ui"
+ >
+
+ <ui:define name="metadata">
+ <f:metadata>
+ <f:viewParam
+ name="departmentId"
+ value="#{adminDepartmentActionController.currentDepartment}"
+ converter="DepartmentConverter"
+ required="true"
+ requiredMessage="#{msg.ERROR_PARAMETER_DEPARTMENT_ID_NOT_SET}"
+ converterMessage="#{msg.PARAMETER_DEPARTMENT_ID_INVALID}"
+ />
+
+ <f:viewAction
+ action="#{adminDepartmentActionController.copyAllDepartmentProperties()}"
+ />
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="document_admin_title">
+ <h:outputText value="#{msg.PAGE_TITLE_ADMIN_EDIT_DEPARTMENT}" />
+ </ui:define>
+
+ <ui:define name="content_header">
+ <h:outputText value="#{msg.CONTENT_TITLE_ADMIN_EDIT_DEPARTMENT}" />
+ </ui:define>
+
+ <ui:define name="content">
+ <h:form
+ id="form-admin-edit-department"
+ rendered="#{not empty adminDepartmentActionController.currentDepartment}"
+ >
+ <h:inputHidden value="#{adminDepartmentActionController.departmentId}" />
+
+ <p:panelGrid
+ columns="1"
+ layout="grid"
+ >
+ <f:facet name="header">
+ <h:outputFormat
+ value="#{msg.ADMIN_EDIT_DEPARTMENT_TITLE}"
+ title="#{beanHelper.renderDepartment(adminDepartmentActionController.currentDepartment, false)}"
+ >
+ <f:param value="#{local[adminDepartmentActionController.departmentI18nKey]}" />
+ <f:param value="#{adminDepartmentActionController.departmentId}" />
+ </h:outputFormat>
+ </f:facet>
+
+ <h:panelGroup styleClass="para" layout="block">
+ <h:outputText value="#{msg.ADMIN_DEPARTMENT_MINIMUM_DATA}" />
+ </h:panelGroup>
+
+ <ui:include src="/WEB-INF/templates/admin/department/admin_form_department_data.tpl" />
+
+ <f:facet name="footer">
+ <p:panelGrid columns="2" layout="grid">
+ <p:commandButton
+ type="reset"
+ value="#{msg.BUTTON_RESET_FORM}"
+ />
+
+ <p:commandButton
+ type="submit"
+ value="#{msg.BUTTON_ADMIN_EDIT_DEPARTMENT}"
+ action="#{adminDepartmentActionController.updateDepartment()}"
+ />
+ </p:panelGrid>
+ </f:facet>
+ </p:panelGrid>
+ </h:form>
+ </ui:define>
+</ui:composition>
<p:column
headerText="#{msg.ADMIN_DEPARTMENT_LEAD_EMPLOYEE}"
- sortBy="#{department.departmentLead.employeePersonalData.contactFamilyName}"
+ sortBy="#{department.departmentLead.contactFamilyName}"
filterBy="#{department.departmentLead}"
filterMatchMode="in"
>
updateLabel="true"
title="#{msg.FILTER_BY_MULTIPLE_EMPLOYEES_TITLE}"
>
- <f:converter converterId="EmployeeConverter" />
+ <f:converter converterId="ContactConverter" />
<f:selectItems
- value="#{employeeListController.allEmployees}"
- var="employee"
- itemValue="#{employee}"
- itemLabel="#{beanHelper.renderEmployee(employee, false, false)}"
+ value="#{contactListController.allContacts}"
+ var="contact"
+ itemValue="#{contact}"
+ itemLabel="#{beanHelper.renderContact(contact)}"
/>
</p:selectCheckboxMenu>
</f:facet>
<p:link
- outcome="admin_show_employee"
- value="#{beanHelper.renderEmployee(department.departmentLead, true)}"
- title="#{msg.ADMIN_LINK_SHOW_DEPARTMENT_LEAD_EMPLOYEE_TITLE}"
+ outcome="admin_show_contact"
+ value="#{beanHelper.renderContact(department.departmentLead)}"
+ title="#{msg.ADMIN_LINK_SHOW_DEPARTMENT_LEAD_CONTACT_TITLE}"
rendered="#{not empty department.departmentLead}"
>
- <f:param name="employeeId" value="#{department.departmentLead.employeeId}" />
+ <f:param name="contactId" value="#{department.departmentLead.contactId}" />
</p:link>
<p:link
- outcome="admin_assign_department_employee"
+ outcome="admin_assign_department_lead"
value="#{msg.ADMIN_LINK_ASSIGN}"
- title="#{msg.ADMIN_LINK_ASSIGN_DEPARTMENTS_LEAD_EMPLOYEE_TITLE}"
+ title="#{msg.ADMIN_LINK_ASSIGN_DEPARTMENTS_LEAD_CONTACT_TITLE}"
rendered="#{empty department.departmentLead}"
>
<f:param name="departmentId" value="#{department.departmentId}" />
<p:commandButton
type="submit"
value="#{msg.BUTTON_ADMIN_ADD_DEPARTMENT_DATA}"
- action="#{adminDepartmentController.addDepartment()}"
+ action="#{adminDepartmentActionController.addDepartment()}"
update="form-list-departments:departmentList"
/>
</p:panelGrid>
<ui:composition
template="/WEB-INF/templates/admin/admin_base.tpl"
xmlns="http://www.w3.org/1999/xhtml"
- xmlns:links="http://mxchange.org/jsf/core/links"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
updateLabel="true"
title="#{msg.FILTER_BY_MULTIPLE_EMPLOYEES_TITLE}"
>
- <f:converter converterId="EmployeeConverter" />
+ <f:converter converterId="ContactConverter" />
<f:selectItems
- value="#{employeeListController.allEmployees}"
- var="employee"
- itemValue="#{employee}"
- itemLabel="#{beanHelper.renderEmployee(employee, false)}"
+ value="#{contactListController.allContacts}"
+ var="contact"
+ itemValue="#{contact}"
+ itemLabel="#{beanHelper.renderContact(contact)}"
/>
</p:selectCheckboxMenu>
</f:facet>
<p:link
- outcome="admin_show_employee"
- value="#{beanHelper.renderEmployee(headquarter.headquarterContactEmployee, false)}"
+ outcome="admin_show_contact"
+ value="#{beanHelper.renderContact(headquarter.headquarterContactEmployee)}"
title="#{msg.ADMIN_LINK_SHOW_HEADQUARTER_CONTACT_PERSON_TITLE}"
rendered="#{not empty headquarter.headquarterContactEmployee}"
>
- <f:param name="employeeId" value="#{headquarter.headquarterContactEmployee.employeeId}" />
+ <f:param name="contactId" value="#{headquarter.headquarterContactEmployee.contactId}" />
</p:link>
<p:link
- outcome="admin_assign_headquarter_employee"
+ outcome="admin_assign_headquarter_contact"
value="#{msg.ADMIN_LINK_ASSIGN}"
title="#{msg.ADMIN_LINK_ASSIGN_HEADQUARTER_CONTACT_PERSON_TITLE}"
rendered="#{empty headquarter.headquarterContactEmployee}"
<h:outputText value="#{msg.ADMIN_ADD_USER_TITLE}" />
</f:facet>
- <!-- Whether select contact data .. //-->
- <!--
- @TODO title="#{msg.ADMIN_SELECT_USER_CONTACT_LEGEND_TITLE}"
- -->
- <p:fieldset legend="#{msg.ADMIN_SELECT_USER_CONTACT_LEGEND}">
+ <p:fieldset
+ legend="#{msg.ADMIN_SELECT_USER_CONTACT_LEGEND}"
+ title="#{msg.ADMIN_SELECT_USER_CONTACT_LEGEND_TITLE}"
+ >
<p:panelGrid
columns="2"
columnClasses="ui-grid-col-3,ui-grid-col-9"