diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopArticleController.java b/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopArticleController.java index 03da5b7..2fc0aa2 100644 --- a/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopArticleController.java +++ b/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopArticleController.java @@ -4,7 +4,6 @@ import org.apache.tomcat.util.http.fileupload.IOUtils; import org.hso.ecommerce.action.shop.GetRandomArticlesAction; import org.hso.ecommerce.entities.shop.Article; import org.hso.ecommerce.entities.shop.ShoppingCart; -import org.hso.ecommerce.entities.warehouse.WarehouseBookingPositionSlotEntry; import org.hso.ecommerce.repos.shop.ArticleRepository; import org.hso.ecommerce.repos.warehouse.WarehouseBookingPositionSlotEntryRepository; import org.springframework.beans.factory.annotation.Autowired; @@ -19,7 +18,6 @@ import javax.servlet.http.HttpSession; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.util.ArrayList; import java.util.List; @Controller @@ -38,20 +36,15 @@ public class ShopArticleController { HttpServletRequest request, HttpServletResponse response ) { - - Article article = articleRepository.findArticleById(id); - if (article == null) { request.setAttribute("error", "Der Artikel wurde nicht gefunden."); response.setStatus(HttpServletResponse.SC_NOT_FOUND); return "error/404"; } - model.addAttribute("article", article); - //if (warehouseBookingPositionSlotEntryRepository.getByArticle(id).get(0).newSumSlot > 0) { //TODO: use this as soon as warehouse works if (true) { model.addAttribute("inStock", true); @@ -62,7 +55,6 @@ public class ShopArticleController { List
commercialArticles = GetRandomArticlesAction.getRandomArticles(3, articleRepository.getAdvertisedArticles()); model.addAttribute("commercialArticles", commercialArticles); - return "shop/articles/id"; } @@ -76,8 +68,6 @@ public class ShopArticleController { @RequestParam(value = "set_amount", required = false) Boolean setAmount, @RequestParam("fastcheckout") Boolean fastcheckout ) { - - Article article = articleRepository.findArticleById(id); if (article == null) { @@ -104,14 +94,10 @@ public class ShopArticleController { HttpServletResponse response, @PathVariable("id") Long id ) throws IOException { - Article article = articleRepository.findArticleById(id); - InputStream in = new FileInputStream(article.image.path); response.setContentType(MediaType.IMAGE_JPEG_VALUE); IOUtils.copy(in, response.getOutputStream()); } - - } diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopIndexController.java b/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopIndexController.java index 4897445..15b6067 100644 --- a/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopIndexController.java +++ b/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopIndexController.java @@ -2,7 +2,6 @@ package org.hso.ecommerce.controller.shop; import org.hso.ecommerce.action.shop.GetRandomArticlesAction; import org.hso.ecommerce.entities.shop.Article; -import org.hso.ecommerce.entities.user.User; import org.hso.ecommerce.repos.shop.ArticleRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -11,7 +10,6 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpSession; -import java.util.ArrayList; import java.util.List; @Controller diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/shop/Image.java b/prototype/src/main/java/org/hso/ecommerce/entities/shop/Image.java index d27d415..6609853 100644 --- a/prototype/src/main/java/org/hso/ecommerce/entities/shop/Image.java +++ b/prototype/src/main/java/org/hso/ecommerce/entities/shop/Image.java @@ -12,5 +12,4 @@ public class Image { public long id; public String path; -} - +} \ No newline at end of file