From: Roland Häder Date: Tue, 17 Oct 2017 20:33:22 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5dd61566a22020343813e5664e815bc52a9e54e0;p=pizzaservice-ejb.git Please cherry-pick: - removed find*ById() method + fixed interface name(s) Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaAdminCompanyEmployeeSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaAdminCompanyEmployeeSessionBean.java deleted file mode 100644 index 85fa30a..0000000 --- a/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaAdminCompanyEmployeeSessionBean.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jcontactsbusiness.model.employee; - -import javax.ejb.Stateless; -import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean; - -/** - * A stateless bean for administrative purposes for company employees. - *

- * @author Roland Häder - */ -@Stateless (name = "adminEmployee", description = "An administrative statless bean for handling company employees") -public class PizzaAdminCompanyEmployeeSessionBean extends BasePizzaEnterpriseBean implements AdminCompanyEmployeeSessionBeanRemote { - - /** - * Serial number - */ - private static final long serialVersionUID = 26_458_796_703_761L; - - /** - * Default constructor - */ - public PizzaAdminCompanyEmployeeSessionBean () { - super(); - } - -} diff --git a/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaAdminEmployeeSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaAdminEmployeeSessionBean.java new file mode 100644 index 0000000..bd5dbb4 --- /dev/null +++ b/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaAdminEmployeeSessionBean.java @@ -0,0 +1,42 @@ +/* + * 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 . + */ +package org.mxchange.jcontactsbusiness.model.employee; + +import javax.ejb.Stateless; +import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean; + +/** + * A stateless bean for administrative purposes for company employees. + *

+ * @author Roland Häder + */ +@Stateless (name = "adminEmployee", description = "An administrative statless bean for handling company employees") +public class PizzaAdminEmployeeSessionBean extends BasePizzaEnterpriseBean implements AdminEmployeeSessionBeanRemote { + + /** + * Serial number + */ + private static final long serialVersionUID = 26_458_796_703_761L; + + /** + * Default constructor + */ + public PizzaAdminCompanyEmployeeSessionBean () { + super(); + } + +} diff --git a/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaCompanyEmployeeSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaCompanyEmployeeSessionBean.java deleted file mode 100644 index 4547737..0000000 --- a/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaCompanyEmployeeSessionBean.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jcontactsbusiness.model.employee; - -import java.text.MessageFormat; -import java.util.List; -import javax.ejb.Stateless; -import javax.persistence.NoResultException; -import javax.persistence.Query; -import org.mxchange.jcontactsbusiness.exceptions.employee.CompanyEmployeeNotFoundException; -import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean; - -/** - * A stateless bean for general purposes for company employees. - *

- * @author Roland Häder - */ -@Stateless (name = "employee", description = "A general statless bean for handling company employees") -public class PizzaCompanyEmployeeSessionBean extends BasePizzaEnterpriseBean implements CompanyEmployeeSessionBeanRemote { - - /** - * Serial number - */ - private static final long serialVersionUID = 26_458_796_703_761L; - - /** - * Default constructor - */ - public PizzaCompanyEmployeeSessionBean () { - super(); - } - - @Override - @SuppressWarnings ("unchecked") - public List allCompanyEmployees () { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allCompanyEmployees(): CALLED!", this.getClass().getSimpleName())); //NOI18N - - // Get named query - final Query query = this.getEntityManager().createNamedQuery("AllCompanyEmployees"); //NOI18N - - // Get list form it - final List employees = query.getResultList(); - - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allCompanyEmployees(): employees.size()={1} - EXIT!", this.getClass().getSimpleName(), employees.size())); //NOI18N - - // Return it - return employees; - } - - @Override - public Employee findCompanyEmployeeById (final Long employeeId) throws CompanyEmployeeNotFoundException { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findCompanyEmployeeById(): employeeId={1} - CALLED!", this.getClass().getSimpleName(), employeeId)); //NOI18N - - // Is the employee id valid? - if (null == employeeId) { - // Throw NPE - throw new NullPointerException("employeeId is null"); //NOI18N - } else if (employeeId < 1) { - // Not valid - throw new IllegalArgumentException(MessageFormat.format("employeeId={0} is not valid", employeeId)); //NOI18N - } - - // Now get named query - final Query query = this.getEntityManager().createNamedQuery("SearchCompanyEmployeeById"); //NOI18N - - // Set parameter - query.setParameter("employeeId", employeeId); //NOI18N - - // Declare instance - final Employee employee; - - // Try to find a result - try { - // Find a single result - employee = (Employee) query.getSingleResult(); - - // Log trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findCompanyEmployeeById: Found employee={1}", this.getClass().getSimpleName(), employee)); //NOI18N - } catch (final NoResultException ex) { - // No result found - throw new CompanyEmployeeNotFoundException(employeeId, ex); - } - - // Log trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findCompanyEmployeeById: employee={1} - EXIT!", this.getClass().getSimpleName(), employee)); //NOI18N - - // Return found instance - return employee; - } - -} diff --git a/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaEmployeeSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaEmployeeSessionBean.java new file mode 100644 index 0000000..7452917 --- /dev/null +++ b/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaEmployeeSessionBean.java @@ -0,0 +1,68 @@ +/* + * 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 . + */ +package org.mxchange.jcontactsbusiness.model.employee; + +import java.text.MessageFormat; +import java.util.List; +import javax.ejb.Stateless; +import javax.persistence.Query; +import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean; + +/** + * A stateless bean for general purposes for company employees. + *

+ * @author Roland Häder + */ +@Stateless (name = "employee", description = "A general statless bean for handling company employees") +public class PizzaEmployeeSessionBean extends BasePizzaEnterpriseBean implements CompanyEmployeeSessionBeanRemote { + + /** + * Serial number + */ + private static final long serialVersionUID = 26_458_796_703_761L; + + /** + * Default constructor + */ +<<<<<<< HEAD:src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaCompanyEmployeeSessionBean.java + public PizzaCompanyEmployeeSessionBean () { +======= + public FinancialsEmployeeSessionBean () { +>>>>>>> 0f4238c5... Please cherry-pick::src/java/org/mxchange/jcontactsbusiness/model/employee/FinancialsEmployeeSessionBean.java + super(); + } + + @Override + @SuppressWarnings ("unchecked") + public List allEmployees () { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allEmployees(): CALLED!", this.getClass().getSimpleName())); //NOI18N + + // Get named query + final Query query = this.getEntityManager().createNamedQuery("AllCompanyEmployees"); //NOI18N + + // Get list form it + final List employees = query.getResultList(); + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allEmployees(): employees.size()={1} - EXIT!", this.getClass().getSimpleName(), employees.size())); //NOI18N + + // Return it + return employees; + } + +}