From 4e0ab68026a8f156694bef753615da2e689f6eb4 Mon Sep 17 00:00:00 2001 From: Martijn Janssen Date: Fri, 17 Mar 2017 16:44:38 +0100 Subject: [PATCH 1/5] Add remove button to groups & fix add product group --- .../payments/admin/products/ProductController.java | 10 +++++++++- .../payments/admin/products/ProductService.java | 2 ++ .../admin/products/ProductServiceImpl.java | 7 +++++++ src/main/resources/templates/products.html | 14 +++++++++++++- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/main/java/ch/wisv/payments/admin/products/ProductController.java b/src/main/java/ch/wisv/payments/admin/products/ProductController.java index 9dc4aa3..f40cbed 100644 --- a/src/main/java/ch/wisv/payments/admin/products/ProductController.java +++ b/src/main/java/ch/wisv/payments/admin/products/ProductController.java @@ -88,9 +88,17 @@ public String deleteProduct(@PathVariable int productId, RedirectAttributes redi return "redirect:/products"; } - @PostMapping(value = "/addGroup") + @PostMapping(value = "/group") public String addProductGroup(@ModelAttribute @Validated ProductGroupRequest productGroupRequest) { productService.addProductGroup(productGroupRequest); + System.out.println("here"); + + return "redirect:/products"; + } + + @PostMapping(value = "/group/delete/{productGroupId}") + public String deleteProductGroup(@PathVariable int productGroupId) { + productService.deleteProductGroup(productGroupId); return "redirect:/products"; } diff --git a/src/main/java/ch/wisv/payments/admin/products/ProductService.java b/src/main/java/ch/wisv/payments/admin/products/ProductService.java index 9dc8899..94388b5 100644 --- a/src/main/java/ch/wisv/payments/admin/products/ProductService.java +++ b/src/main/java/ch/wisv/payments/admin/products/ProductService.java @@ -38,4 +38,6 @@ public interface ProductService { void addProductGroup(ProductGroupRequest productGroupRequest); void addProductToGroup(Product product, ProductGroup productGroup); + + void deleteProductGroup(int productGroupId); } diff --git a/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java b/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java index 4304cb3..45d4750 100644 --- a/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java +++ b/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java @@ -139,4 +139,11 @@ public void deleteProduct(int productId) { productRepository.delete(productId); } } + + @Override + public void deleteProductGroup(int productGroupId) { + productGroupRepository.findOne(productGroupId).getProducts() + .forEach(p -> p.setProductGroup(null)); + productGroupRepository.delete(productGroupId); + } } diff --git a/src/main/resources/templates/products.html b/src/main/resources/templates/products.html index 156da77..d0733af 100644 --- a/src/main/resources/templates/products.html +++ b/src/main/resources/templates/products.html @@ -155,7 +155,7 @@

Add Product Group

-
@@ -227,6 +227,18 @@

Add Product Group

+ + +
+ + + + +
+ + From 820034b00cf16de050372d6ccdae0866caf0cc1f Mon Sep 17 00:00:00 2001 From: Martijn Janssen Date: Fri, 17 Mar 2017 20:07:57 +0100 Subject: [PATCH 2/5] Add edit page & change removal constraints --- .../admin/products/ProductController.java | 40 +++++++- .../admin/products/ProductService.java | 4 + .../admin/products/ProductServiceImpl.java | 46 ++++++--- .../products/request/ProductRequest.java | 2 +- .../exception/ProductGroupInUseException.java | 7 ++ .../templates/{edit.html => editProduct.html} | 4 +- .../resources/templates/editProductGroup.html | 93 +++++++++++++++++++ src/main/resources/templates/products.html | 16 +--- 8 files changed, 181 insertions(+), 31 deletions(-) create mode 100644 src/main/java/ch/wisv/payments/exception/ProductGroupInUseException.java rename src/main/resources/templates/{edit.html => editProduct.html} (97%) create mode 100644 src/main/resources/templates/editProductGroup.html diff --git a/src/main/java/ch/wisv/payments/admin/products/ProductController.java b/src/main/java/ch/wisv/payments/admin/products/ProductController.java index f40cbed..b0d56af 100644 --- a/src/main/java/ch/wisv/payments/admin/products/ProductController.java +++ b/src/main/java/ch/wisv/payments/admin/products/ProductController.java @@ -4,6 +4,7 @@ import ch.wisv.payments.admin.products.request.ProductGroupRequest; import ch.wisv.payments.admin.products.request.ProductRequest; import ch.wisv.payments.model.Product; +import ch.wisv.payments.model.ProductGroup; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -43,7 +44,7 @@ public String productEdit(@PathVariable Integer productId, Model model) { Product product = productService.getProductById(productId); ProductRequest productRequest = new ProductRequest(); - productRequest.setProductId(product.getId()); + productRequest.setId(product.getId()); productRequest.setName(product.getName()); productRequest.setDescription(product.getDescription()); productRequest.setPrice(product.getPrice()); @@ -58,7 +59,7 @@ public String productEdit(@PathVariable Integer productId, Model model) { model.addAttribute("product", productRequest); - return "edit"; + return "editProduct"; } @PostMapping(value = "/add") @@ -96,9 +97,40 @@ public String addProductGroup(@ModelAttribute @Validated ProductGroupRequest pro return "redirect:/products"; } + @GetMapping(value = "/group/edit/{productGroupId}") + public String productGroupEdit(@PathVariable Integer productGroupId, Model model) { + model.addAttribute("committees", committeeService.getAllCommittees()); + + ProductGroup productGroup = productService.getProductGroupById(productGroupId); + ProductGroupRequest productGroupRequest = new ProductGroupRequest(); + + productGroupRequest.setId(productGroup.getId()); + productGroupRequest.setName(productGroup.getName()); + productGroupRequest.setCommitteeId(productGroup.getCommittee().getId()); + productGroupRequest.setDescription(productGroup.getDescription()); + productGroupRequest.setGroupLimit(productGroup.getGroupLimit()); + + model.addAttribute("productGroup", productGroupRequest); + + return "editProductGroup"; + } + + @PostMapping(value = "/group/edit") + public String editProductGroup(@ModelAttribute @Validated ProductGroupRequest productGroupRequest, RedirectAttributes redirectAttributes) { + productService.editProductGroup(productGroupRequest); + + redirectAttributes.addFlashAttribute("message", productGroupRequest.getName() + " successfully updated!"); + + return "redirect:/products"; + } + @PostMapping(value = "/group/delete/{productGroupId}") - public String deleteProductGroup(@PathVariable int productGroupId) { - productService.deleteProductGroup(productGroupId); + public String deleteProductGroup(@PathVariable int productGroupId, RedirectAttributes redirectAttributes) { + try { + productService.deleteProductGroup(productGroupId); + } catch (RuntimeException e) { + redirectAttributes.addFlashAttribute("error", e.getMessage()); + } return "redirect:/products"; } diff --git a/src/main/java/ch/wisv/payments/admin/products/ProductService.java b/src/main/java/ch/wisv/payments/admin/products/ProductService.java index 94388b5..1d1e2f6 100644 --- a/src/main/java/ch/wisv/payments/admin/products/ProductService.java +++ b/src/main/java/ch/wisv/payments/admin/products/ProductService.java @@ -40,4 +40,8 @@ public interface ProductService { void addProductToGroup(Product product, ProductGroup productGroup); void deleteProductGroup(int productGroupId); + + ProductGroup getProductGroupById(Integer productGroupId); + + void editProductGroup(ProductGroupRequest productGroupRequest); } diff --git a/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java b/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java index 45d4750..b410332 100644 --- a/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java +++ b/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java @@ -4,6 +4,7 @@ import ch.wisv.payments.admin.products.request.ProductGroupRequest; import ch.wisv.payments.admin.products.request.ProductRequest; import ch.wisv.payments.exception.CommmitteeNotFoundException; +import ch.wisv.payments.exception.ProductGroupInUseException; import ch.wisv.payments.exception.ProductInUseException; import ch.wisv.payments.model.*; import ch.wisv.payments.rest.OrderService; @@ -79,9 +80,9 @@ public void addProductToGroup(Product product, ProductGroup productGroup) { @Override public void editProduct(ProductRequest productRequest) { - if (productRequest.getProductId() != 0) { + if (productRequest.getId() != 0) { Committee committee = committeeRepository.findOne(productRequest.getCommitteeId()); - Product product = productRepository.findOne(productRequest.getProductId()); + Product product = productRepository.findOne(productRequest.getId()); product.setName(productRequest.getName()); product.setDescription(productRequest.getDescription()); @@ -102,6 +103,17 @@ public void editProduct(ProductRequest productRequest) { } } + @Override + public void deleteProduct(int productId) { + List orders = orderService.getOrdersByProductId(productId); + + if (orders.size() > 0) { + throw new ProductInUseException("Products are already ordered"); + } else { + productRepository.delete(productId); + } + } + @Override public Product getProductById(Integer productId) { return productRepository.findOne(productId); @@ -130,20 +142,32 @@ public boolean isProductAvailable(Integer productId) { } @Override - public void deleteProduct(int productId) { - List orders = orderService.getOrdersByProductId(productId); + public ProductGroup getProductGroupById(Integer productGroupId) { + return productGroupRepository.findOne(productGroupId); + } - if (orders.size() > 0) { - throw new ProductInUseException("Products are already ordered"); - } else { - productRepository.delete(productId); + @Override + public void editProductGroup(ProductGroupRequest productGroupRequest) { + if (productGroupRequest.getId() != 0) { + Committee committee = committeeRepository.findOne(productGroupRequest.getCommitteeId()); + ProductGroup productGroup = productGroupRepository.findOne(productGroupRequest.getId()); + + productGroup.setCommittee(committee); + productGroup.setName(productGroupRequest.getName()); + productGroup.setDescription(productGroupRequest.getDescription()); + productGroup.setGroupLimit(productGroupRequest.getGroupLimit()); + + productGroupRepository.saveAndFlush(productGroup); } } @Override public void deleteProductGroup(int productGroupId) { - productGroupRepository.findOne(productGroupId).getProducts() - .forEach(p -> p.setProductGroup(null)); - productGroupRepository.delete(productGroupId); + ProductGroup productGroup = productGroupRepository.findOne(productGroupId); + if (!productGroup.getProducts().isEmpty()) { + throw new ProductGroupInUseException("Product group must be empty"); + } else { + productGroupRepository.delete(productGroupId); + } } } diff --git a/src/main/java/ch/wisv/payments/admin/products/request/ProductRequest.java b/src/main/java/ch/wisv/payments/admin/products/request/ProductRequest.java index 1e8e674..c9bcd20 100644 --- a/src/main/java/ch/wisv/payments/admin/products/request/ProductRequest.java +++ b/src/main/java/ch/wisv/payments/admin/products/request/ProductRequest.java @@ -10,7 +10,7 @@ public class ProductRequest { @Getter @Setter - int productId; + int id; @Setter @Getter int committeeId; diff --git a/src/main/java/ch/wisv/payments/exception/ProductGroupInUseException.java b/src/main/java/ch/wisv/payments/exception/ProductGroupInUseException.java new file mode 100644 index 0000000..99edb80 --- /dev/null +++ b/src/main/java/ch/wisv/payments/exception/ProductGroupInUseException.java @@ -0,0 +1,7 @@ +package ch.wisv.payments.exception; + +public class ProductGroupInUseException extends RuntimeException { + public ProductGroupInUseException(String s) { + super(s); + } +} diff --git a/src/main/resources/templates/edit.html b/src/main/resources/templates/editProduct.html similarity index 97% rename from src/main/resources/templates/edit.html rename to src/main/resources/templates/editProduct.html index 7fd5747..6c0509d 100644 --- a/src/main/resources/templates/edit.html +++ b/src/main/resources/templates/editProduct.html @@ -49,7 +49,7 @@

Edit

- +
- +
diff --git a/src/main/resources/templates/editProductGroup.html b/src/main/resources/templates/editProductGroup.html new file mode 100644 index 0000000..8ac9016 --- /dev/null +++ b/src/main/resources/templates/editProductGroup.html @@ -0,0 +1,93 @@ + + + + + + + + + + + + CH Payments + + + + + + + + + + + + + + + +
+ +
+ +
+
+
+
+
+

Products

+ +
+
+
+

Edit

+
+
+ +
+ +
+ + +
+
+ + +
+
+ + +
+
+ +
+ +
+
+ +
+
+
+
+
+
+ + + + + + diff --git a/src/main/resources/templates/products.html b/src/main/resources/templates/products.html index d0733af..7318161 100644 --- a/src/main/resources/templates/products.html +++ b/src/main/resources/templates/products.html @@ -217,22 +217,12 @@

Add Product Group

  • List item
  • - - - - - - - - - -
    - - - + + + From 31170feb2da15fe1114b7e05965585da5c5fe065 Mon Sep 17 00:00:00 2001 From: Martijn Janssen Date: Fri, 17 Mar 2017 21:41:13 +0100 Subject: [PATCH 3/5] Fix comments on PR --- .../admin/committees/CommitteeService.java | 6 ++++ .../committees/CommitteeServiceImpl.java | 17 ++++++++- .../admin/products/ProductController.java | 36 ++++++++++--------- .../admin/products/ProductServiceImpl.java | 23 ++++++------ .../exception/CommitteeNotFoundException.java | 4 +++ .../CommmitteeNotFoundException.java | 4 --- .../exception/EmptyOrderException.java | 2 +- src/main/resources/templates/products.html | 2 +- 8 files changed, 59 insertions(+), 35 deletions(-) create mode 100644 src/main/java/ch/wisv/payments/exception/CommitteeNotFoundException.java delete mode 100644 src/main/java/ch/wisv/payments/exception/CommmitteeNotFoundException.java diff --git a/src/main/java/ch/wisv/payments/admin/committees/CommitteeService.java b/src/main/java/ch/wisv/payments/admin/committees/CommitteeService.java index 596232f..8968703 100644 --- a/src/main/java/ch/wisv/payments/admin/committees/CommitteeService.java +++ b/src/main/java/ch/wisv/payments/admin/committees/CommitteeService.java @@ -1,12 +1,18 @@ package ch.wisv.payments.admin.committees; import ch.wisv.payments.model.Committee; +import ch.wisv.payments.model.CommitteeEnum; import java.util.List; +import java.util.Optional; public interface CommitteeService { List getAllCommittees(); void addCommittee(Committee committee); + + Committee getCommitteeById(int committeeId); + + Committee getCommittee(CommitteeEnum committeeEnum, int year); } diff --git a/src/main/java/ch/wisv/payments/admin/committees/CommitteeServiceImpl.java b/src/main/java/ch/wisv/payments/admin/committees/CommitteeServiceImpl.java index ed79dd0..5460a94 100644 --- a/src/main/java/ch/wisv/payments/admin/committees/CommitteeServiceImpl.java +++ b/src/main/java/ch/wisv/payments/admin/committees/CommitteeServiceImpl.java @@ -1,11 +1,15 @@ package ch.wisv.payments.admin.committees; +import ch.wisv.payments.exception.CommitteeNotFoundException; import ch.wisv.payments.model.Committee; +import ch.wisv.payments.model.CommitteeEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DuplicateKeyException; import org.springframework.stereotype.Service; +import javax.swing.text.html.Option; import java.util.List; +import java.util.Optional; @Service public class CommitteeServiceImpl implements CommitteeService { @@ -25,8 +29,19 @@ public List getAllCommittees() { @Override public void addCommittee(Committee committee) { if (committeeRepository.findOneByNameAndYear(committee.getName(), committee.getYear()).isPresent()) { - throw new DuplicateKeyException("Commitee already exists!"); + throw new DuplicateKeyException("Committee already exists!"); } committeeRepository.save(committee); } + + @Override + public Committee getCommitteeById(int committeeId) { + return committeeRepository.findOne(committeeId); + } + + @Override + public Committee getCommittee(CommitteeEnum committeeEnum, int year) { + return committeeRepository.findOneByNameAndYear(committeeEnum, year) + .orElseThrow(CommitteeNotFoundException::new); + } } diff --git a/src/main/java/ch/wisv/payments/admin/products/ProductController.java b/src/main/java/ch/wisv/payments/admin/products/ProductController.java index b0d56af..fe067a2 100644 --- a/src/main/java/ch/wisv/payments/admin/products/ProductController.java +++ b/src/main/java/ch/wisv/payments/admin/products/ProductController.java @@ -63,9 +63,10 @@ public String productEdit(@PathVariable Integer productId, Model model) { } @PostMapping(value = "/add") - public String addProduct(@ModelAttribute @Validated ProductRequest productRequest) { + public String addProduct(@ModelAttribute @Validated ProductRequest productRequest, RedirectAttributes redirectAttributes) { productService.addProduct(productRequest); + redirectAttributes.addFlashAttribute("message", productRequest.getName() + " successfully added."); return "redirect:/products"; } @@ -73,26 +74,23 @@ public String addProduct(@ModelAttribute @Validated ProductRequest productReques public String editProduct(@ModelAttribute @Validated ProductRequest productRequest, RedirectAttributes redirectAttributes) { productService.editProduct(productRequest); - redirectAttributes.addFlashAttribute("message", productRequest.getName() + " successfully updated!"); - + redirectAttributes.addFlashAttribute("message", productRequest.getName() + " successfully updated."); return "redirect:/products"; } @PostMapping(value = "/delete/{productId}") public String deleteProduct(@PathVariable int productId, RedirectAttributes redirectAttributes) { - try { - productService.deleteProduct(productId); - } catch (RuntimeException e) { - redirectAttributes.addFlashAttribute("error", e.getMessage()); - } + productService.deleteProduct(productId); + redirectAttributes.addFlashAttribute("message", "Product successfully removed."); return "redirect:/products"; } - @PostMapping(value = "/group") - public String addProductGroup(@ModelAttribute @Validated ProductGroupRequest productGroupRequest) { + @PostMapping(value = "/group/add") + public String addProductGroup(@ModelAttribute @Validated ProductGroupRequest productGroupRequest, RedirectAttributes redirectAttributes) { productService.addProductGroup(productGroupRequest); - System.out.println("here"); + + redirectAttributes.addFlashAttribute("message", "Product group " + productGroupRequest.getName() + " successfully added."); return "redirect:/products"; } @@ -119,18 +117,22 @@ public String productGroupEdit(@PathVariable Integer productGroupId, Model model public String editProductGroup(@ModelAttribute @Validated ProductGroupRequest productGroupRequest, RedirectAttributes redirectAttributes) { productService.editProductGroup(productGroupRequest); - redirectAttributes.addFlashAttribute("message", productGroupRequest.getName() + " successfully updated!"); + redirectAttributes.addFlashAttribute("message", productGroupRequest.getName() + " successfully updated."); return "redirect:/products"; } @PostMapping(value = "/group/delete/{productGroupId}") public String deleteProductGroup(@PathVariable int productGroupId, RedirectAttributes redirectAttributes) { - try { - productService.deleteProductGroup(productGroupId); - } catch (RuntimeException e) { - redirectAttributes.addFlashAttribute("error", e.getMessage()); - } + productService.deleteProductGroup(productGroupId); + redirectAttributes.addFlashAttribute("message", "Product group successfully removed."); + + return "redirect:/products"; + } + + @ExceptionHandler(RuntimeException.class) + public String formErrorHandler(RuntimeException e, RedirectAttributes redirectAttributes) { + redirectAttributes.addFlashAttribute("error", e.getMessage()); return "redirect:/products"; } diff --git a/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java b/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java index b410332..17ab7cf 100644 --- a/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java +++ b/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java @@ -1,13 +1,16 @@ package ch.wisv.payments.admin.products; import ch.wisv.payments.admin.committees.CommitteeRepository; +import ch.wisv.payments.admin.committees.CommitteeService; +import ch.wisv.payments.admin.committees.CommitteeServiceImpl; import ch.wisv.payments.admin.products.request.ProductGroupRequest; import ch.wisv.payments.admin.products.request.ProductRequest; -import ch.wisv.payments.exception.CommmitteeNotFoundException; +import ch.wisv.payments.exception.CommitteeNotFoundException; import ch.wisv.payments.exception.ProductGroupInUseException; import ch.wisv.payments.exception.ProductInUseException; import ch.wisv.payments.model.*; import ch.wisv.payments.rest.OrderService; +import ch.wisv.payments.rest.OrderServiceImpl; import ch.wisv.payments.rest.repository.ProductGroupRepository; import ch.wisv.payments.rest.repository.ProductRepository; import org.springframework.beans.factory.annotation.Autowired; @@ -21,14 +24,13 @@ public class ProductServiceImpl implements ProductService { private ProductRepository productRepository; private ProductGroupRepository productGroupRepository; - private CommitteeRepository committeeRepository; + private CommitteeService committeeService; private OrderService orderService; - @Autowired - public ProductServiceImpl(ProductRepository productRepository, ProductGroupRepository productGroupRepository, CommitteeRepository committeeRepository, OrderService orderService) { + public ProductServiceImpl(ProductRepository productRepository, ProductGroupRepository productGroupRepository, CommitteeService committeeService, OrderService orderService) { this.productRepository = productRepository; this.productGroupRepository = productGroupRepository; - this.committeeRepository = committeeRepository; + this.committeeService = committeeService; this.orderService = orderService; } @@ -39,7 +41,7 @@ public List getAllProducts() { @Override public void addProduct(ProductRequest productRequest) { - Committee committee = committeeRepository.findOne(productRequest.getCommitteeId()); + Committee committee = committeeService.getCommitteeById(productRequest.getCommitteeId()); Product product = new Product(committee, productRequest.getName(), productRequest.getDescription(), @@ -57,7 +59,7 @@ public void addProduct(ProductRequest productRequest) { @Override public void addProductGroup(ProductGroupRequest productGroupRequest) { - Committee committee = committeeRepository.findOne(productGroupRequest.getCommitteeId()); + Committee committee = committeeService.getCommitteeById(productGroupRequest.getCommitteeId()); ProductGroup group = new ProductGroup(productGroupRequest.getName(), productGroupRequest.getDescription(), productGroupRequest.getGroupLimit(), committee); @@ -81,7 +83,7 @@ public void addProductToGroup(Product product, ProductGroup productGroup) { @Override public void editProduct(ProductRequest productRequest) { if (productRequest.getId() != 0) { - Committee committee = committeeRepository.findOne(productRequest.getCommitteeId()); + Committee committee = committeeService.getCommitteeById(productRequest.getCommitteeId()); Product product = productRepository.findOne(productRequest.getId()); product.setName(productRequest.getName()); @@ -121,8 +123,7 @@ public Product getProductById(Integer productId) { @Override public Set getProductByCommittee(CommitteeEnum committeeEnum, int year) { - Committee committee = committeeRepository.findOneByNameAndYear(committeeEnum, year) - .orElseThrow(CommmitteeNotFoundException::new); + Committee committee = committeeService.getCommittee(committeeEnum, year); return productRepository.findByCommittee(committee); } @@ -149,7 +150,7 @@ public ProductGroup getProductGroupById(Integer productGroupId) { @Override public void editProductGroup(ProductGroupRequest productGroupRequest) { if (productGroupRequest.getId() != 0) { - Committee committee = committeeRepository.findOne(productGroupRequest.getCommitteeId()); + Committee committee = committeeService.getCommitteeById(productGroupRequest.getCommitteeId()); ProductGroup productGroup = productGroupRepository.findOne(productGroupRequest.getId()); productGroup.setCommittee(committee); diff --git a/src/main/java/ch/wisv/payments/exception/CommitteeNotFoundException.java b/src/main/java/ch/wisv/payments/exception/CommitteeNotFoundException.java new file mode 100644 index 0000000..411bafd --- /dev/null +++ b/src/main/java/ch/wisv/payments/exception/CommitteeNotFoundException.java @@ -0,0 +1,4 @@ +package ch.wisv.payments.exception; + +public class CommitteeNotFoundException extends RuntimeException { +} diff --git a/src/main/java/ch/wisv/payments/exception/CommmitteeNotFoundException.java b/src/main/java/ch/wisv/payments/exception/CommmitteeNotFoundException.java deleted file mode 100644 index 1c604b1..0000000 --- a/src/main/java/ch/wisv/payments/exception/CommmitteeNotFoundException.java +++ /dev/null @@ -1,4 +0,0 @@ -package ch.wisv.payments.exception; - -public class CommmitteeNotFoundException extends RuntimeException { -} diff --git a/src/main/java/ch/wisv/payments/exception/EmptyOrderException.java b/src/main/java/ch/wisv/payments/exception/EmptyOrderException.java index 21b23a0..ee7c105 100644 --- a/src/main/java/ch/wisv/payments/exception/EmptyOrderException.java +++ b/src/main/java/ch/wisv/payments/exception/EmptyOrderException.java @@ -1,8 +1,8 @@ package ch.wisv.payments.exception; public class EmptyOrderException extends RuntimeException { - public EmptyOrderException(String s) { super(s); } } + diff --git a/src/main/resources/templates/products.html b/src/main/resources/templates/products.html index 7318161..992ece3 100644 --- a/src/main/resources/templates/products.html +++ b/src/main/resources/templates/products.html @@ -155,7 +155,7 @@

    Add Product Group

    -
    From 4e8e76f7518a35d3ecd0ef419dfbf913dafe22b4 Mon Sep 17 00:00:00 2001 From: Martijn Janssen Date: Fri, 17 Mar 2017 21:44:16 +0100 Subject: [PATCH 4/5] Remove unused imports --- .../ch/wisv/payments/admin/committees/CommitteeService.java | 1 - .../wisv/payments/admin/committees/CommitteeServiceImpl.java | 2 -- .../ch/wisv/payments/admin/products/ProductServiceImpl.java | 5 ----- 3 files changed, 8 deletions(-) diff --git a/src/main/java/ch/wisv/payments/admin/committees/CommitteeService.java b/src/main/java/ch/wisv/payments/admin/committees/CommitteeService.java index 8968703..0751fe7 100644 --- a/src/main/java/ch/wisv/payments/admin/committees/CommitteeService.java +++ b/src/main/java/ch/wisv/payments/admin/committees/CommitteeService.java @@ -4,7 +4,6 @@ import ch.wisv.payments.model.CommitteeEnum; import java.util.List; -import java.util.Optional; public interface CommitteeService { diff --git a/src/main/java/ch/wisv/payments/admin/committees/CommitteeServiceImpl.java b/src/main/java/ch/wisv/payments/admin/committees/CommitteeServiceImpl.java index 5460a94..3d2d190 100644 --- a/src/main/java/ch/wisv/payments/admin/committees/CommitteeServiceImpl.java +++ b/src/main/java/ch/wisv/payments/admin/committees/CommitteeServiceImpl.java @@ -7,9 +7,7 @@ import org.springframework.dao.DuplicateKeyException; import org.springframework.stereotype.Service; -import javax.swing.text.html.Option; import java.util.List; -import java.util.Optional; @Service public class CommitteeServiceImpl implements CommitteeService { diff --git a/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java b/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java index 17ab7cf..f04a9ca 100644 --- a/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java +++ b/src/main/java/ch/wisv/payments/admin/products/ProductServiceImpl.java @@ -1,19 +1,14 @@ package ch.wisv.payments.admin.products; -import ch.wisv.payments.admin.committees.CommitteeRepository; import ch.wisv.payments.admin.committees.CommitteeService; -import ch.wisv.payments.admin.committees.CommitteeServiceImpl; import ch.wisv.payments.admin.products.request.ProductGroupRequest; import ch.wisv.payments.admin.products.request.ProductRequest; -import ch.wisv.payments.exception.CommitteeNotFoundException; import ch.wisv.payments.exception.ProductGroupInUseException; import ch.wisv.payments.exception.ProductInUseException; import ch.wisv.payments.model.*; import ch.wisv.payments.rest.OrderService; -import ch.wisv.payments.rest.OrderServiceImpl; import ch.wisv.payments.rest.repository.ProductGroupRepository; import ch.wisv.payments.rest.repository.ProductRepository; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; From bf2ed000e7852561ba06c3b9be133e97086bb7ca Mon Sep 17 00:00:00 2001 From: Martijn Janssen Date: Fri, 17 Mar 2017 22:31:55 +0100 Subject: [PATCH 5/5] Fix formatting in forms --- src/main/resources/templates/editProduct.html | 3 +-- .../resources/templates/editProductGroup.html | 3 +-- src/main/resources/templates/products.html | 16 +++++++--------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/main/resources/templates/editProduct.html b/src/main/resources/templates/editProduct.html index 6c0509d..e97889a 100644 --- a/src/main/resources/templates/editProduct.html +++ b/src/main/resources/templates/editProduct.html @@ -47,8 +47,7 @@

    Edit

    - +
    diff --git a/src/main/resources/templates/editProductGroup.html b/src/main/resources/templates/editProductGroup.html index 8ac9016..32af118 100644 --- a/src/main/resources/templates/editProductGroup.html +++ b/src/main/resources/templates/editProductGroup.html @@ -47,8 +47,7 @@

    Edit

    - +
    diff --git a/src/main/resources/templates/products.html b/src/main/resources/templates/products.html index 992ece3..3f6b185 100644 --- a/src/main/resources/templates/products.html +++ b/src/main/resources/templates/products.html @@ -49,8 +49,7 @@

    Add products

    - +
    - +
    -
    +
    Add products
    -
    +
    @@ -155,8 +154,7 @@

    Add Product Group

    - +