From 34ab8551aa582cc6099145d4e77ae3ce63ba794c Mon Sep 17 00:00:00 2001
From: Roland Haeder <roland@mxchange.org>
Date: Sun, 6 Sep 2015 10:25:39 +0200
Subject: [PATCH] =?utf8?q?No=20tags=20in=20EJBs,=20maybe=20not=20JSF,=20to?=
 =?utf8?q?o=3F=20Signed-off-by:Roland=20H=C3=A4der=20<roland@mxchange.org>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

---
 .../tags/basket/BasketTag.java                |  27 ---
 .../tags/basket/MiniBasketTag.java            | 154 ------------------
 2 files changed, 181 deletions(-)
 delete mode 100644 PizzaService-ejb/src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java
 delete mode 100644 PizzaService-ejb/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java

diff --git a/PizzaService-ejb/src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java b/PizzaService-ejb/src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java
deleted file mode 100644
index 5e8ae1b..0000000
--- a/PizzaService-ejb/src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.tags.basket;
-
-import javax.servlet.jsp.tagext.BodyTag;
-
-/**
- * An interface for a (mini) basket tag.
- *
- * @author Roland Haeder
- */
-public interface BasketTag extends BodyTag {
-}
diff --git a/PizzaService-ejb/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java b/PizzaService-ejb/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java
deleted file mode 100644
index 3dfe70a..0000000
--- a/PizzaService-ejb/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.tags.basket;
-
-import java.io.IOException;
-import java.rmi.RemoteException;
-import java.text.MessageFormat;
-import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.tagext.BodyTagSupport;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.mxchange.jshopcore.model.item.AddableBasketItem;
-import org.mxchange.jshopcore.model.product.Product;
-import org.mxchange.jshopejb.beans.remote.shop.ShopSessionBeanRemote;
-
-/**
- * A basket tag that outputs a small basket and a link to the full basket website.
- *
- * @author Roland Haeder
- * TODO: Does JSF use "foreign" tags like this?
- */
-public class MiniBasketTag extends BodyTagSupport implements BasketTag {
-	/**
-	 * Serial number
-	 */
-	private static final long serialVersionUID = 457415727452384L;
-
-	/**
-	 * Logger instance
-	 */
-	private final Logger LOG;
-
-	/**
-	 * Initializer
-	 */
-	{
-		this.LOG = LogManager.getLogger(this);
-	}
-
-	/**
-	 * Outputs a div container with last added item + a link to the basket
-	 * web page.
-	 *
-	 * @return No need to process the body
-	 * @throws JspException If anything happens
-	 */
-	@Override
-	public int doStartTag () throws JspException {
-		// Trace message
-		this.LOG.trace("CALLED!"); //NOI18N
-
-		// Init output
-		StringBuilder out = new StringBuilder("<div class=\"mini_basket\">\n"); //NOI18N
-
-		// basket should not be null
-		if (this.getBasket() == null) {
-			// Not set
-			throw new NullPointerException("basket instance is null"); //NOI18N
-		}
-
-		try {
-			// Some entries found?
-			if (this.getBasket().isEmpty()) {
-				// Empty basket
-				out.append("<div class=\"mini_basket_box\">\n"); //NOI18N
-				out.append(this.getBasket().getMessageStringFromKey("MiniBasketTag.basket_is_empty")).append("\n"); //NOI18N
-				out.append("</div>\n"); //NOI18N
-			} else {
-				// Get all items
-				AddableBasketItem item = this.getBasket().getLast();
-
-				// item cannot be null here
-				if (null == item) {
-					// Abort here
-					throw new NullPointerException("item is null"); //NOI18N
-				}
-
-				// Get application bean from session
-				ShopSessionBeanRemote bean = (ShopSessionBeanRemote) this.getBasket().getSession().getAttribute("controller"); //NOI18N
-
-				// Debug log
-				this.LOG.debug(MessageFormat.format("bean={0}", bean)); //NOI18N
-
-				// Should not be null
-				if (null == bean) {
-					// Abort here
-					throw new NullPointerException("bean is null"); //NOI18N
-				}
-
-				// Get product instance
-				Product product = bean.getProduct(item);
-
-				// Debug message
-				this.LOG.debug(MessageFormat.format("product={0}", product)); //NOI18N
-
-				// Get last num rows
-				int lastNumRows = this.getBasket().getLastNumRows();
-
-				// Debug message
-				this.LOG.debug(MessageFormat.format("lastNumRows={0}", lastNumRows)); //NOI18N
-
-				// Output all
-				out.append("<div class=\"mini_basket_box\">\n"); //NOI18N
-				out.append("  <div class=\"mini_basket_header\">\n"); //NOI18N
-				out.append("    ").append(this.getBasket().getMessageStringFromKey("MiniBasketTag.header")).append("\n"); //NOI18N
-				out.append("  </div>\n"); //NOI18N
-				out.append("  <div class=\"mini_basket_last\">\n"); //NOI18N
-				out.append("    ").append(MessageFormat.format(this.getBasket().getMessageStringFromKey("MiniBasketTag.last_item"), product.getTitle())); //NOI18N
-				out.append("  </div>\n"); //NOI18N
-				out.append("  <div class=\"mini_basket_more\">\n"); //NOI18N
-				out.append("    ").append(MessageFormat.format(this.getBasket().getMessageStringFromKey("MiniBasketTag.additional_items"), (lastNumRows - 1))); //NOI18N
-				out.append("  </div>\n"); //NOI18N
-				out.append("  <div class=\"mini_basket_link\">\n"); //NOI18N
-				out.append("    <a href=\"").append(this.getBasket().getApplication().getContextPath()).append("/basket.jsp\">").append(this.getBasket().getMessageStringFromKey("MiniBasketTag.to_basket")).append("</a>\n"); //NOI18N
-				out.append("  </div>\n"); //NOI18N
-				out.append("</div>\n"); //NOI18N
-			}
-		} catch (final RemoteException ex) {
-			// Continue to throw
-			throw new JspException(ex);
-		}
-
-		// Close div here
-		out.append("</div>\n"); //NOI18N
-
-		try {
-			// Get output instance and write it
-			this.pageContext.getOut().print(out.toString());
-		} catch (final IOException ex) {
-			// Continue to throw
-			throw new JspException(ex);
-		}
-
-		// Trace message
-		this.LOG.trace(MessageFormat.format("Returning {0} ... - EXIT!", SKIP_BODY)); //NOI18N
-
-		// Don't process any body
-		return SKIP_BODY;
-	}
-}
-- 
2.39.5