Permalink
Browse files

changing mind... removing .aj files in favor of maven exec task

  • Loading branch information...
krimple committed Sep 1, 2012
1 parent 14b6f37 commit fb9b781c88d1ec1092dc7cfdb03de6939a218847
Showing with 6,018 additions and 0 deletions.
  1. +102 −0 .../pizzashop-activerecord/src/main/java/com/springsource/pizzashop/BaseController_Roo_Controller.aj
  2. +95 −0 ...ashop-activerecord/src/main/java/com/springsource/pizzashop/BaseController_Roo_Controller_Json.aj
  3. +106 −0 ...pizzashop-activerecord/src/main/java/com/springsource/pizzashop/PizzaController_Roo_Controller.aj
  4. +95 −0 ...shop-activerecord/src/main/java/com/springsource/pizzashop/PizzaController_Roo_Controller_Json.aj
  5. +124 −0 ...shop-activerecord/src/main/java/com/springsource/pizzashop/PizzaOrderController_Roo_Controller.aj
  6. +96 −0 ...activerecord/src/main/java/com/springsource/pizzashop/PizzaOrderController_Roo_Controller_Json.aj
  7. +102 −0 ...zzashop-activerecord/src/main/java/com/springsource/pizzashop/ToppingController_Roo_Controller.aj
  8. +95 −0 ...op-activerecord/src/main/java/com/springsource/pizzashop/ToppingController_Roo_Controller_Json.aj
  9. +13 −0 ...o/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_Configurable.aj
  10. +18 −0 ...intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_JavaBean.aj
  11. +77 −0 ...zzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_Jpa_ActiveRecord.aj
  12. +43 −0 ...tro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_Jpa_Entity.aj
  13. +31 −0 ...-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_Json.aj
  14. +16 −0 ...intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_ToString.aj
  15. +13 −0 ...hop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Configurable.aj
  16. +27 −0 ...pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Equals.aj
  17. +36 −0 ...ashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Identifier.aj
  18. +31 −0 ...o/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Json.aj
  19. +15 −0 ...hop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Serializable.aj
  20. +16 −0 ...zzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_ToString.aj
  21. +13 −0 ...ashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Configurable.aj
  22. +54 −0 ...pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_JavaBean.aj
  23. +78 −0 ...p-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Jpa_ActiveRecord.aj
  24. +40 −0 ...zzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Jpa_Entity.aj
  25. +31 −0 ...tro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Json.aj
  26. +16 −0 ...pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_ToString.aj
  27. +13 −0 .../pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_Configurable.aj
  28. +46 −0 ...ntro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_JavaBean.aj
  29. +77 −0 ...zashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_Jpa_ActiveRecord.aj
  30. +43 −0 ...ro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_Jpa_Entity.aj
  31. +31 −0 ...01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_Json.aj
  32. +16 −0 ...ntro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_ToString.aj
  33. +13 −0 ...izzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Configurable.aj
  34. +18 −0 ...ro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_JavaBean.aj
  35. +77 −0 ...shop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Jpa_ActiveRecord.aj
  36. +43 −0 .../pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Jpa_Entity.aj
  37. +31 −0 ...-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Json.aj
  38. +16 −0 ...ro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_ToString.aj
  39. +155 −0 ...a/com/springsource/pizzashop/web/ApplicationConversionServiceFactoryBean_Roo_ConversionService.aj
  40. +13 −0 ...activerecord/src/test/java/com/springsource/pizzashop/domain/BaseDataOnDemand_Roo_Configurable.aj
  41. +89 −0 ...activerecord/src/test/java/com/springsource/pizzashop/domain/BaseDataOnDemand_Roo_DataOnDemand.aj
  42. +13 −0 ...iverecord/src/test/java/com/springsource/pizzashop/domain/BaseIntegrationTest_Roo_Configurable.aj
  43. +121 −0 ...record/src/test/java/com/springsource/pizzashop/domain/BaseIntegrationTest_Roo_IntegrationTest.aj
  44. +13 −0 ...ctiverecord/src/test/java/com/springsource/pizzashop/domain/PizzaDataOnDemand_Roo_Configurable.aj
  45. +101 −0 ...ctiverecord/src/test/java/com/springsource/pizzashop/domain/PizzaDataOnDemand_Roo_DataOnDemand.aj
  46. +13 −0 ...verecord/src/test/java/com/springsource/pizzashop/domain/PizzaIntegrationTest_Roo_Configurable.aj
  47. +121 −0 ...ecord/src/test/java/com/springsource/pizzashop/domain/PizzaIntegrationTest_Roo_IntegrationTest.aj
  48. +13 −0 ...record/src/test/java/com/springsource/pizzashop/domain/PizzaOrderDataOnDemand_Roo_Configurable.aj
  49. +125 −0 ...record/src/test/java/com/springsource/pizzashop/domain/PizzaOrderDataOnDemand_Roo_DataOnDemand.aj
  50. +13 −0 ...ord/src/test/java/com/springsource/pizzashop/domain/PizzaOrderIntegrationTest_Roo_Configurable.aj
  51. +121 −0 .../src/test/java/com/springsource/pizzashop/domain/PizzaOrderIntegrationTest_Roo_IntegrationTest.aj
  52. +13 −0 ...iverecord/src/test/java/com/springsource/pizzashop/domain/ToppingDataOnDemand_Roo_Configurable.aj
  53. +89 −0 ...iverecord/src/test/java/com/springsource/pizzashop/domain/ToppingDataOnDemand_Roo_DataOnDemand.aj
  54. +13 −0 ...record/src/test/java/com/springsource/pizzashop/domain/ToppingIntegrationTest_Roo_Configurable.aj
  55. +121 −0 ...ord/src/test/java/com/springsource/pizzashop/domain/ToppingIntegrationTest_Roo_IntegrationTest.aj
  56. +18 −0 ...r-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Base_Roo_JavaBean.aj
  57. +43 −0 ...01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Base_Roo_Jpa_Entity.aj
  58. +31 −0 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Base_Roo_Json.aj
  59. +16 −0 ...r-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Base_Roo_ToString.aj
  60. +13 −0 ...izzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Configurable.aj
  61. +27 −0 ...ntro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Equals.aj
  62. +36 −0 .../pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Identifier.aj
  63. +31 −0 ...-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Json.aj
  64. +15 −0 ...izzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Serializable.aj
  65. +16 −0 ...ro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_ToString.aj
  66. +54 −0 ...ntro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_JavaBean.aj
  67. +40 −0 ...ro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Jpa_Entity.aj
  68. +31 −0 ...01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Json.aj
  69. +16 −0 ...ntro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_ToString.aj
  70. +46 −0 ...-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_JavaBean.aj
  71. +43 −0 ...1-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_Jpa_Entity.aj
  72. +31 −0 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_Json.aj
  73. +16 −0 ...-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_ToString.aj
  74. +18 −0 ...1-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_JavaBean.aj
  75. +43 −0 ...intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Jpa_Entity.aj
  76. +31 −0 ...er-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Json.aj
  77. +16 −0 ...1-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_ToString.aj
  78. +20 −0 ...-layered/src/main/java/com/springsource/pizzashop/repository/BaseRepository_Roo_Jpa_Repository.aj
  79. +21 −0 ...ed/src/main/java/com/springsource/pizzashop/repository/PizzaOrderRepository_Roo_Jpa_Repository.aj
  80. +20 −0 ...layered/src/main/java/com/springsource/pizzashop/repository/PizzaRepository_Roo_Jpa_Repository.aj
  81. +20 −0 ...yered/src/main/java/com/springsource/pizzashop/repository/ToppingRepository_Roo_Jpa_Repository.aj
  82. +51 −0 ...pizzashop-layered/src/main/java/com/springsource/pizzashop/service/BaseServiceImpl_Roo_Service.aj
  83. +19 −0 ...tro/pizzashop-layered/src/main/java/com/springsource/pizzashop/service/BaseService_Roo_Service.aj
  84. +52 −0 ...hop-layered/src/main/java/com/springsource/pizzashop/service/PizzaOrderServiceImpl_Roo_Service.aj
  85. +20 −0 ...zzashop-layered/src/main/java/com/springsource/pizzashop/service/PizzaOrderService_Roo_Service.aj
  86. +51 −0 ...izzashop-layered/src/main/java/com/springsource/pizzashop/service/PizzaServiceImpl_Roo_Service.aj
  87. +19 −0 ...ro/pizzashop-layered/src/main/java/com/springsource/pizzashop/service/PizzaService_Roo_Service.aj
  88. +51 −0 ...zashop-layered/src/main/java/com/springsource/pizzashop/service/ToppingServiceImpl_Roo_Service.aj
  89. +19 −0 .../pizzashop-layered/src/main/java/com/springsource/pizzashop/service/ToppingService_Roo_Service.aj
  90. +172 −0 ...a/com/springsource/pizzashop/web/ApplicationConversionServiceFactoryBean_Roo_ConversionService.aj
  91. +107 −0 ...o/pizzashop-layered/src/main/java/com/springsource/pizzashop/web/BaseController_Roo_Controller.aj
  92. +95 −0 ...zashop-layered/src/main/java/com/springsource/pizzashop/web/BaseController_Roo_Controller_Json.aj
  93. +117 −0 .../pizzashop-layered/src/main/java/com/springsource/pizzashop/web/PizzaController_Roo_Controller.aj
  94. +95 −0 ...ashop-layered/src/main/java/com/springsource/pizzashop/web/PizzaController_Roo_Controller_Json.aj
  95. +131 −0 ...ashop-layered/src/main/java/com/springsource/pizzashop/web/PizzaOrderController_Roo_Controller.aj
  96. +96 −0 ...-layered/src/main/java/com/springsource/pizzashop/web/PizzaOrderController_Roo_Controller_Json.aj
  97. +107 −0 ...izzashop-layered/src/main/java/com/springsource/pizzashop/web/ToppingController_Roo_Controller.aj
  98. +95 −0 ...hop-layered/src/main/java/com/springsource/pizzashop/web/ToppingController_Roo_Controller_Json.aj
  99. +13 −0 ...shop-layered/src/test/java/com/springsource/pizzashop/domain/BaseDataOnDemand_Roo_Configurable.aj
  100. +98 −0 ...shop-layered/src/test/java/com/springsource/pizzashop/domain/BaseDataOnDemand_Roo_DataOnDemand.aj
  101. +13 −0 ...p-layered/src/test/java/com/springsource/pizzashop/domain/BaseIntegrationTest_Roo_Configurable.aj
  102. +128 −0 ...ayered/src/test/java/com/springsource/pizzashop/domain/BaseIntegrationTest_Roo_IntegrationTest.aj
  103. +13 −0 ...hop-layered/src/test/java/com/springsource/pizzashop/domain/PizzaDataOnDemand_Roo_Configurable.aj
  104. +109 −0 ...hop-layered/src/test/java/com/springsource/pizzashop/domain/PizzaDataOnDemand_Roo_DataOnDemand.aj
  105. +13 −0 ...-layered/src/test/java/com/springsource/pizzashop/domain/PizzaIntegrationTest_Roo_Configurable.aj
  106. +128 −0 ...yered/src/test/java/com/springsource/pizzashop/domain/PizzaIntegrationTest_Roo_IntegrationTest.aj
  107. +13 −0 ...ayered/src/test/java/com/springsource/pizzashop/domain/PizzaOrderDataOnDemand_Roo_Configurable.aj
  108. +134 −0 ...ayered/src/test/java/com/springsource/pizzashop/domain/PizzaOrderDataOnDemand_Roo_DataOnDemand.aj
  109. +13 −0 ...red/src/test/java/com/springsource/pizzashop/domain/PizzaOrderIntegrationTest_Roo_Configurable.aj
  110. +128 −0 .../src/test/java/com/springsource/pizzashop/domain/PizzaOrderIntegrationTest_Roo_IntegrationTest.aj
  111. +13 −0 ...p-layered/src/test/java/com/springsource/pizzashop/domain/ToppingDataOnDemand_Roo_Configurable.aj
  112. +98 −0 ...p-layered/src/test/java/com/springsource/pizzashop/domain/ToppingDataOnDemand_Roo_DataOnDemand.aj
  113. +13 −0 ...ayered/src/test/java/com/springsource/pizzashop/domain/ToppingIntegrationTest_Roo_Configurable.aj
  114. +128 −0 ...red/src/test/java/com/springsource/pizzashop/domain/ToppingIntegrationTest_Roo_IntegrationTest.aj
@@ -0,0 +1,102 @@
+// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
+// You may push code into the target .java compilation unit if you wish to edit any member(s).
+
+package com.springsource.pizzashop;
+
+import com.springsource.pizzashop.BaseController;
+import com.springsource.pizzashop.domain.Base;
+import java.io.UnsupportedEncodingException;
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import org.springframework.ui.Model;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.util.UriUtils;
+import org.springframework.web.util.WebUtils;
+
+privileged aspect BaseController_Roo_Controller {
+
+ @RequestMapping(method = RequestMethod.POST, produces = "text/html")
+ public String BaseController.create(@Valid Base base, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
+ if (bindingResult.hasErrors()) {
+ populateEditForm(uiModel, base);
+ return "bases/create";
+ }
+ uiModel.asMap().clear();
+ base.persist();
+ return "redirect:/bases/" + encodeUrlPathSegment(base.getId().toString(), httpServletRequest);
+ }
+
+ @RequestMapping(params = "form", produces = "text/html")
+ public String BaseController.createForm(Model uiModel) {
+ populateEditForm(uiModel, new Base());
+ return "bases/create";
+ }
+
+ @RequestMapping(value = "/{id}", produces = "text/html")
+ public String BaseController.show(@PathVariable("id") Long id, Model uiModel) {
+ uiModel.addAttribute("base", Base.findBase(id));
+ uiModel.addAttribute("itemId", id);
+ return "bases/show";
+ }
+
+ @RequestMapping(produces = "text/html")
+ public String BaseController.list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
+ if (page != null || size != null) {
+ int sizeNo = size == null ? 10 : size.intValue();
+ final int firstResult = page == null ? 0 : (page.intValue() - 1) * sizeNo;
+ uiModel.addAttribute("bases", Base.findBaseEntries(firstResult, sizeNo));
+ float nrOfPages = (float) Base.countBases() / sizeNo;
+ uiModel.addAttribute("maxPages", (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages));
+ } else {
+ uiModel.addAttribute("bases", Base.findAllBases());
+ }
+ return "bases/list";
+ }
+
+ @RequestMapping(method = RequestMethod.PUT, produces = "text/html")
+ public String BaseController.update(@Valid Base base, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
+ if (bindingResult.hasErrors()) {
+ populateEditForm(uiModel, base);
+ return "bases/update";
+ }
+ uiModel.asMap().clear();
+ base.merge();
+ return "redirect:/bases/" + encodeUrlPathSegment(base.getId().toString(), httpServletRequest);
+ }
+
+ @RequestMapping(value = "/{id}", params = "form", produces = "text/html")
+ public String BaseController.updateForm(@PathVariable("id") Long id, Model uiModel) {
+ populateEditForm(uiModel, Base.findBase(id));
+ return "bases/update";
+ }
+
+ @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
+ public String BaseController.delete(@PathVariable("id") Long id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
+ Base base = Base.findBase(id);
+ base.remove();
+ uiModel.asMap().clear();
+ uiModel.addAttribute("page", (page == null) ? "1" : page.toString());
+ uiModel.addAttribute("size", (size == null) ? "10" : size.toString());
+ return "redirect:/bases";
+ }
+
+ void BaseController.populateEditForm(Model uiModel, Base base) {
+ uiModel.addAttribute("base", base);
+ }
+
+ String BaseController.encodeUrlPathSegment(String pathSegment, HttpServletRequest httpServletRequest) {
+ String enc = httpServletRequest.getCharacterEncoding();
+ if (enc == null) {
+ enc = WebUtils.DEFAULT_CHARACTER_ENCODING;
+ }
+ try {
+ pathSegment = UriUtils.encodePathSegment(pathSegment, enc);
+ } catch (UnsupportedEncodingException uee) {}
+ return pathSegment;
+ }
+
+}
@@ -0,0 +1,95 @@
+// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
+// You may push code into the target .java compilation unit if you wish to edit any member(s).
+
+package com.springsource.pizzashop;
+
+import com.springsource.pizzashop.BaseController;
+import com.springsource.pizzashop.domain.Base;
+import java.util.List;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+privileged aspect BaseController_Roo_Controller_Json {
+
+ @RequestMapping(value = "/{id}", headers = "Accept=application/json")
+ @ResponseBody
+ public ResponseEntity<String> BaseController.showJson(@PathVariable("id") Long id) {
+ Base base = Base.findBase(id);
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json; charset=utf-8");
+ if (base == null) {
+ return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
+ }
+ return new ResponseEntity<String>(base.toJson(), headers, HttpStatus.OK);
+ }
+
+ @RequestMapping(headers = "Accept=application/json")
+ @ResponseBody
+ public ResponseEntity<String> BaseController.listJson() {
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json; charset=utf-8");
+ List<Base> result = Base.findAllBases();
+ return new ResponseEntity<String>(Base.toJsonArray(result), headers, HttpStatus.OK);
+ }
+
+ @RequestMapping(method = RequestMethod.POST, headers = "Accept=application/json")
+ public ResponseEntity<String> BaseController.createFromJson(@RequestBody String json) {
+ Base base = Base.fromJsonToBase(json);
+ base.persist();
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json");
+ return new ResponseEntity<String>(headers, HttpStatus.CREATED);
+ }
+
+ @RequestMapping(value = "/jsonArray", method = RequestMethod.POST, headers = "Accept=application/json")
+ public ResponseEntity<String> BaseController.createFromJsonArray(@RequestBody String json) {
+ for (Base base: Base.fromJsonArrayToBases(json)) {
+ base.persist();
+ }
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json");
+ return new ResponseEntity<String>(headers, HttpStatus.CREATED);
+ }
+
+ @RequestMapping(method = RequestMethod.PUT, headers = "Accept=application/json")
+ public ResponseEntity<String> BaseController.updateFromJson(@RequestBody String json) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json");
+ Base base = Base.fromJsonToBase(json);
+ if (base.merge() == null) {
+ return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
+ }
+ return new ResponseEntity<String>(headers, HttpStatus.OK);
+ }
+
+ @RequestMapping(value = "/jsonArray", method = RequestMethod.PUT, headers = "Accept=application/json")
+ public ResponseEntity<String> BaseController.updateFromJsonArray(@RequestBody String json) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json");
+ for (Base base: Base.fromJsonArrayToBases(json)) {
+ if (base.merge() == null) {
+ return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
+ }
+ }
+ return new ResponseEntity<String>(headers, HttpStatus.OK);
+ }
+
+ @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, headers = "Accept=application/json")
+ public ResponseEntity<String> BaseController.deleteFromJson(@PathVariable("id") Long id) {
+ Base base = Base.findBase(id);
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json");
+ if (base == null) {
+ return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
+ }
+ base.remove();
+ return new ResponseEntity<String>(headers, HttpStatus.OK);
+ }
+
+}
@@ -0,0 +1,106 @@
+// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
+// You may push code into the target .java compilation unit if you wish to edit any member(s).
+
+package com.springsource.pizzashop;
+
+import com.springsource.pizzashop.PizzaController;
+import com.springsource.pizzashop.domain.Base;
+import com.springsource.pizzashop.domain.Pizza;
+import com.springsource.pizzashop.domain.Topping;
+import java.io.UnsupportedEncodingException;
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import org.springframework.ui.Model;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.util.UriUtils;
+import org.springframework.web.util.WebUtils;
+
+privileged aspect PizzaController_Roo_Controller {
+
+ @RequestMapping(method = RequestMethod.POST, produces = "text/html")
+ public String PizzaController.create(@Valid Pizza pizza, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
+ if (bindingResult.hasErrors()) {
+ populateEditForm(uiModel, pizza);
+ return "pizzas/create";
+ }
+ uiModel.asMap().clear();
+ pizza.persist();
+ return "redirect:/pizzas/" + encodeUrlPathSegment(pizza.getId().toString(), httpServletRequest);
+ }
+
+ @RequestMapping(params = "form", produces = "text/html")
+ public String PizzaController.createForm(Model uiModel) {
+ populateEditForm(uiModel, new Pizza());
+ return "pizzas/create";
+ }
+
+ @RequestMapping(value = "/{id}", produces = "text/html")
+ public String PizzaController.show(@PathVariable("id") Long id, Model uiModel) {
+ uiModel.addAttribute("pizza", Pizza.findPizza(id));
+ uiModel.addAttribute("itemId", id);
+ return "pizzas/show";
+ }
+
+ @RequestMapping(produces = "text/html")
+ public String PizzaController.list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
+ if (page != null || size != null) {
+ int sizeNo = size == null ? 10 : size.intValue();
+ final int firstResult = page == null ? 0 : (page.intValue() - 1) * sizeNo;
+ uiModel.addAttribute("pizzas", Pizza.findPizzaEntries(firstResult, sizeNo));
+ float nrOfPages = (float) Pizza.countPizzas() / sizeNo;
+ uiModel.addAttribute("maxPages", (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages));
+ } else {
+ uiModel.addAttribute("pizzas", Pizza.findAllPizzas());
+ }
+ return "pizzas/list";
+ }
+
+ @RequestMapping(method = RequestMethod.PUT, produces = "text/html")
+ public String PizzaController.update(@Valid Pizza pizza, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
+ if (bindingResult.hasErrors()) {
+ populateEditForm(uiModel, pizza);
+ return "pizzas/update";
+ }
+ uiModel.asMap().clear();
+ pizza.merge();
+ return "redirect:/pizzas/" + encodeUrlPathSegment(pizza.getId().toString(), httpServletRequest);
+ }
+
+ @RequestMapping(value = "/{id}", params = "form", produces = "text/html")
+ public String PizzaController.updateForm(@PathVariable("id") Long id, Model uiModel) {
+ populateEditForm(uiModel, Pizza.findPizza(id));
+ return "pizzas/update";
+ }
+
+ @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
+ public String PizzaController.delete(@PathVariable("id") Long id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
+ Pizza pizza = Pizza.findPizza(id);
+ pizza.remove();
+ uiModel.asMap().clear();
+ uiModel.addAttribute("page", (page == null) ? "1" : page.toString());
+ uiModel.addAttribute("size", (size == null) ? "10" : size.toString());
+ return "redirect:/pizzas";
+ }
+
+ void PizzaController.populateEditForm(Model uiModel, Pizza pizza) {
+ uiModel.addAttribute("pizza", pizza);
+ uiModel.addAttribute("bases", Base.findAllBases());
+ uiModel.addAttribute("toppings", Topping.findAllToppings());
+ }
+
+ String PizzaController.encodeUrlPathSegment(String pathSegment, HttpServletRequest httpServletRequest) {
+ String enc = httpServletRequest.getCharacterEncoding();
+ if (enc == null) {
+ enc = WebUtils.DEFAULT_CHARACTER_ENCODING;
+ }
+ try {
+ pathSegment = UriUtils.encodePathSegment(pathSegment, enc);
+ } catch (UnsupportedEncodingException uee) {}
+ return pathSegment;
+ }
+
+}
Oops, something went wrong.

0 comments on commit fb9b781

Please sign in to comment.