From: Roland Häder Date: Thu, 10 Aug 2017 20:47:53 +0000 (+0200) Subject: Also needs to be moved as jcontact-business-core has changed (good convention). X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=26b217476263b5c1cb97924df663ca04b77f5d1b;p=pizzaservice-ejb.git Also needs to be moved as jcontact-business-core has changed (good convention). Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jcontactsbusiness/PizzaAdminBusinessDataSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/PizzaAdminBusinessDataSessionBean.java deleted file mode 100644 index 4dfaeaa..0000000 --- a/src/java/org/mxchange/jcontactsbusiness/PizzaAdminBusinessDataSessionBean.java +++ /dev/null @@ -1,65 +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; - -import java.text.MessageFormat; -import java.util.List; -import javax.ejb.Stateless; -import javax.persistence.Query; -import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean; - -/** - * An administrative stateless session bean for business data - *

- * @author Roland Häder - */ -@Stateless (name = "adminBusinessData", description = "An administrative statless bean for handling business data (all)") -public class PizzaAdminBusinessDataSessionBean extends BasePizzaDatabaseBean implements BusinessDataAdminSessionBeanRemote { - - /** - * Serial number - */ - private static final long serialVersionUID = 56_389_504_892_184_572L; - - /** - * Default constructor - */ - public PizzaAdminBusinessDataSessionBean () { - // Call super constructor - super(); - } - - @Override - @SuppressWarnings ("unchecked") - public List allBusinessContacts () { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allBusinessContacts: CALLED!", this.getClass().getSimpleName())); //NOI18N - - // Get query - Query query = this.getEntityManager().createNamedQuery("AllBusinessData"); //NOI18N - - // Get list from it - List list = query.getResultList(); - - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allBusinessContacts: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N - - // Return it - return list; - } - -} diff --git a/src/java/org/mxchange/jcontactsbusiness/PizzaBusinessDataSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/PizzaBusinessDataSessionBean.java deleted file mode 100644 index 1eea667..0000000 --- a/src/java/org/mxchange/jcontactsbusiness/PizzaBusinessDataSessionBean.java +++ /dev/null @@ -1,80 +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; - -import java.text.MessageFormat; -import javax.ejb.Stateless; -import javax.persistence.NoResultException; -import javax.persistence.Query; -import org.mxchange.jcontactsbusiness.exceptions.BusinessDataNotFoundException; -import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean; - -/** - * A stateless session bean for business data - *

- * @author Roland Häder - */ -@Stateless (name = "businessData", description = "A general statless bean for handling business data (all)") -public class PizzaBusinessDataSessionBean extends BasePizzaDatabaseBean implements BusinessDataSessionBeanRemote { - - /** - * Serial number - */ - private static final long serialVersionUID = 56_389_504_892_184_571L; - - /** - * Default constructor - */ - public PizzaBusinessDataSessionBean () { - // Call super constructor - super(); - } - - @Override - public BusinessBasicData findBusinessDataById (final Long businessDataId) throws BusinessDataNotFoundException { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findBusinessDataById: CALLED!", this.getClass().getSimpleName())); //NOI18N - - // Get query - Query query = this.getEntityManager().createNamedQuery("SearchBusinessDataById", CompanyBasicData.class); //NOI18N - - // Set parameter - query.setParameter("businessDataId", businessDataId); //NOI18N - - // Get single instance - BusinessBasicData businessData = null; - - // Try to find a result - try { - // Find a single result - businessData = (BusinessBasicData) query.getSingleResult(); - - // Log trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findBusinessDataById: Found contact={1}", this.getClass().getSimpleName(), businessData)); //NOI18N - } catch (final NoResultException ex) { - // No result found - throw new BusinessDataNotFoundException(businessDataId, ex); - } - - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findBusinessDataById: businessData={1} - EXIT!", this.getClass().getSimpleName(), businessData)); //NOI18N - - // Return it - return businessData; - } - -} diff --git a/src/java/org/mxchange/jcontactsbusiness/basicdata/PizzaAdminBusinessDataSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/basicdata/PizzaAdminBusinessDataSessionBean.java new file mode 100644 index 0000000..072dfc1 --- /dev/null +++ b/src/java/org/mxchange/jcontactsbusiness/basicdata/PizzaAdminBusinessDataSessionBean.java @@ -0,0 +1,67 @@ +/* + * 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.basicdata; + +import org.mxchange.jcontactsbusiness.basicdata.BusinessDataAdminSessionBeanRemote; +import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; +import java.text.MessageFormat; +import java.util.List; +import javax.ejb.Stateless; +import javax.persistence.Query; +import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean; + +/** + * An administrative stateless session bean for business data + *

+ * @author Roland Häder + */ +@Stateless (name = "adminBusinessData", description = "An administrative statless bean for handling business data (all)") +public class PizzaAdminBusinessDataSessionBean extends BasePizzaDatabaseBean implements BusinessDataAdminSessionBeanRemote { + + /** + * Serial number + */ + private static final long serialVersionUID = 56_389_504_892_184_572L; + + /** + * Default constructor + */ + public PizzaAdminBusinessDataSessionBean () { + // Call super constructor + super(); + } + + @Override + @SuppressWarnings ("unchecked") + public List allBusinessContacts () { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allBusinessContacts: CALLED!", this.getClass().getSimpleName())); //NOI18N + + // Get query + Query query = this.getEntityManager().createNamedQuery("AllBusinessData"); //NOI18N + + // Get list from it + List list = query.getResultList(); + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allBusinessContacts: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N + + // Return it + return list; + } + +} diff --git a/src/java/org/mxchange/jcontactsbusiness/basicdata/PizzaBusinessDataSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/basicdata/PizzaBusinessDataSessionBean.java new file mode 100644 index 0000000..2c24790 --- /dev/null +++ b/src/java/org/mxchange/jcontactsbusiness/basicdata/PizzaBusinessDataSessionBean.java @@ -0,0 +1,80 @@ +/* + * 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.basicdata; + +import java.text.MessageFormat; +import javax.ejb.Stateless; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import org.mxchange.jcontactsbusiness.exceptions.BusinessDataNotFoundException; +import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean; + +/** + * A stateless session bean for business data + *

+ * @author Roland Häder + */ +@Stateless (name = "businessData", description = "A general statless bean for handling business data (all)") +public class PizzaBusinessDataSessionBean extends BasePizzaDatabaseBean implements BusinessDataSessionBeanRemote { + + /** + * Serial number + */ + private static final long serialVersionUID = 56_389_504_892_184_571L; + + /** + * Default constructor + */ + public PizzaBusinessDataSessionBean () { + // Call super constructor + super(); + } + + @Override + public BusinessBasicData findBusinessDataById (final Long businessDataId) throws BusinessDataNotFoundException { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findBusinessDataById: CALLED!", this.getClass().getSimpleName())); //NOI18N + + // Get query + Query query = this.getEntityManager().createNamedQuery("SearchBusinessDataById", CompanyBasicData.class); //NOI18N + + // Set parameter + query.setParameter("businessDataId", businessDataId); //NOI18N + + // Get single instance + BusinessBasicData businessData = null; + + // Try to find a result + try { + // Find a single result + businessData = (BusinessBasicData) query.getSingleResult(); + + // Log trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findBusinessDataById: Found contact={1}", this.getClass().getSimpleName(), businessData)); //NOI18N + } catch (final NoResultException ex) { + // No result found + throw new BusinessDataNotFoundException(businessDataId, ex); + } + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findBusinessDataById: businessData={1} - EXIT!", this.getClass().getSimpleName(), businessData)); //NOI18N + + // Return it + return businessData; + } + +}