Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit fb9b781c88d1ec1092dc7cfdb03de6939a218847 1 parent 14b6f37
@krimple authored
Showing with 6,018 additions and 0 deletions.
  1. +102 −0 ...r-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/BaseController_Roo_Controller.aj
  2. +95 −0 ...intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/BaseController_Roo_Controller_Json.aj
  3. +106 −0 ...-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/PizzaController_Roo_Controller.aj
  4. +95 −0 ...ntro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/PizzaController_Roo_Controller_Json.aj
  5. +124 −0 ...ntro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/PizzaOrderController_Roo_Controller.aj
  6. +96 −0 ...pizzashop-activerecord/src/main/java/com/springsource/pizzashop/PizzaOrderController_Roo_Controller_Json.aj
  7. +102 −0 ...1-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/ToppingController_Roo_Controller.aj
  8. +95 −0 ...ro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/ToppingController_Roo_Controller_Json.aj
  9. +13 −0 ...er-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_Configurable.aj
  10. +18 −0 chapter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_JavaBean.aj
  11. +77 −0 ...1-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_Jpa_ActiveRecord.aj
  12. +43 −0 chapter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_Jpa_Entity.aj
  13. +31 −0 chapter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_Json.aj
  14. +16 −0 chapter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_ToString.aj
  15. +13 −0 ...tro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Configurable.aj
  16. +27 −0 ...-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Equals.aj
  17. +36 −0 ...intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Identifier.aj
  18. +31 −0 ...er-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Json.aj
  19. +15 −0 ...tro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Serializable.aj
  20. +16 −0 ...1-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_ToString.aj
  21. +13 −0 ...intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Configurable.aj
  22. +54 −0 ...-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_JavaBean.aj
  23. +78 −0 ...o/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Jpa_ActiveRecord.aj
  24. +40 −0 ...1-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Jpa_Entity.aj
  25. +31 −0 chapter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Json.aj
  26. +16 −0 ...-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_ToString.aj
  27. +13 −0 ...r-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_Configurable.aj
  28. +46 −0 chapter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_JavaBean.aj
  29. +77 −0 ...-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_Jpa_ActiveRecord.aj
  30. +43 −0 ...ter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_Jpa_Entity.aj
  31. +31 −0 chapter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_Json.aj
  32. +16 −0 chapter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_ToString.aj
  33. +13 −0 ...01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Configurable.aj
  34. +18 −0 ...ter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_JavaBean.aj
  35. +77 −0 ...ntro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Jpa_ActiveRecord.aj
  36. +43 −0 ...r-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Jpa_Entity.aj
  37. +31 −0 chapter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Json.aj
  38. +16 −0 ...ter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_ToString.aj
  39. +155 −0 ...c/main/java/com/springsource/pizzashop/web/ApplicationConversionServiceFactoryBean_Roo_ConversionService.aj
  40. +13 −0 ...pizzashop-activerecord/src/test/java/com/springsource/pizzashop/domain/BaseDataOnDemand_Roo_Configurable.aj
  41. +89 −0 ...pizzashop-activerecord/src/test/java/com/springsource/pizzashop/domain/BaseDataOnDemand_Roo_DataOnDemand.aj
  42. +13 −0 ...zashop-activerecord/src/test/java/com/springsource/pizzashop/domain/BaseIntegrationTest_Roo_Configurable.aj
  43. +121 −0 ...hop-activerecord/src/test/java/com/springsource/pizzashop/domain/BaseIntegrationTest_Roo_IntegrationTest.aj
  44. +13 −0 ...izzashop-activerecord/src/test/java/com/springsource/pizzashop/domain/PizzaDataOnDemand_Roo_Configurable.aj
  45. +101 −0 ...izzashop-activerecord/src/test/java/com/springsource/pizzashop/domain/PizzaDataOnDemand_Roo_DataOnDemand.aj
  46. +13 −0 ...ashop-activerecord/src/test/java/com/springsource/pizzashop/domain/PizzaIntegrationTest_Roo_Configurable.aj
  47. +121 −0 ...op-activerecord/src/test/java/com/springsource/pizzashop/domain/PizzaIntegrationTest_Roo_IntegrationTest.aj
  48. +13 −0 ...hop-activerecord/src/test/java/com/springsource/pizzashop/domain/PizzaOrderDataOnDemand_Roo_Configurable.aj
  49. +125 −0 ...hop-activerecord/src/test/java/com/springsource/pizzashop/domain/PizzaOrderDataOnDemand_Roo_DataOnDemand.aj
  50. +13 −0 ...-activerecord/src/test/java/com/springsource/pizzashop/domain/PizzaOrderIntegrationTest_Roo_Configurable.aj
  51. +121 −0 ...tiverecord/src/test/java/com/springsource/pizzashop/domain/PizzaOrderIntegrationTest_Roo_IntegrationTest.aj
  52. +13 −0 ...zashop-activerecord/src/test/java/com/springsource/pizzashop/domain/ToppingDataOnDemand_Roo_Configurable.aj
  53. +89 −0 ...zashop-activerecord/src/test/java/com/springsource/pizzashop/domain/ToppingDataOnDemand_Roo_DataOnDemand.aj
  54. +13 −0 ...hop-activerecord/src/test/java/com/springsource/pizzashop/domain/ToppingIntegrationTest_Roo_Configurable.aj
  55. +121 −0 ...-activerecord/src/test/java/com/springsource/pizzashop/domain/ToppingIntegrationTest_Roo_IntegrationTest.aj
  56. +18 −0 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Base_Roo_JavaBean.aj
  57. +43 −0 chapter-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 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Base_Roo_ToString.aj
  60. +13 −0 ...01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Configurable.aj
  61. +27 −0 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Equals.aj
  62. +36 −0 ...r-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Identifier.aj
  63. +31 −0 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Json.aj
  64. +15 −0 ...01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Serializable.aj
  65. +16 −0 ...ter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_ToString.aj
  66. +54 −0 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_JavaBean.aj
  67. +40 −0 ...ter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Jpa_Entity.aj
  68. +31 −0 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Json.aj
  69. +16 −0 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_ToString.aj
  70. +46 −0 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_JavaBean.aj
  71. +43 −0 chapter-01-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 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_ToString.aj
  74. +18 −0 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_JavaBean.aj
  75. +43 −0 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Jpa_Entity.aj
  76. +31 −0 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Json.aj
  77. +16 −0 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_ToString.aj
  78. +20 −0 .../pizzashop-layered/src/main/java/com/springsource/pizzashop/repository/BaseRepository_Roo_Jpa_Repository.aj
  79. +21 −0 ...shop-layered/src/main/java/com/springsource/pizzashop/repository/PizzaOrderRepository_Roo_Jpa_Repository.aj
  80. +20 −0 ...pizzashop-layered/src/main/java/com/springsource/pizzashop/repository/PizzaRepository_Roo_Jpa_Repository.aj
  81. +20 −0 ...zzashop-layered/src/main/java/com/springsource/pizzashop/repository/ToppingRepository_Roo_Jpa_Repository.aj
  82. +51 −0 ...-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/service/BaseServiceImpl_Roo_Service.aj
  83. +19 −0 chapter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/service/BaseService_Roo_Service.aj
  84. +52 −0 ...tro/pizzashop-layered/src/main/java/com/springsource/pizzashop/service/PizzaOrderServiceImpl_Roo_Service.aj
  85. +20 −0 ...1-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/service/PizzaOrderService_Roo_Service.aj
  86. +51 −0 ...01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/service/PizzaServiceImpl_Roo_Service.aj
  87. +19 −0 ...ter-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/service/PizzaService_Roo_Service.aj
  88. +51 −0 ...-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/service/ToppingServiceImpl_Roo_Service.aj
  89. +19 −0 ...r-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/service/ToppingService_Roo_Service.aj
  90. +172 −0 ...c/main/java/com/springsource/pizzashop/web/ApplicationConversionServiceFactoryBean_Roo_ConversionService.aj
  91. +107 −0 ...er-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/web/BaseController_Roo_Controller.aj
  92. +95 −0 ...-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/web/BaseController_Roo_Controller_Json.aj
  93. +117 −0 ...r-01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/web/PizzaController_Roo_Controller.aj
  94. +95 −0 ...intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/web/PizzaController_Roo_Controller_Json.aj
  95. +131 −0 ...intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/web/PizzaOrderController_Roo_Controller.aj
  96. +96 −0 .../pizzashop-layered/src/main/java/com/springsource/pizzashop/web/PizzaOrderController_Roo_Controller_Json.aj
  97. +107 −0 ...01-intro/pizzashop-layered/src/main/java/com/springsource/pizzashop/web/ToppingController_Roo_Controller.aj
  98. +95 −0 ...tro/pizzashop-layered/src/main/java/com/springsource/pizzashop/web/ToppingController_Roo_Controller_Json.aj
  99. +13 −0 ...ntro/pizzashop-layered/src/test/java/com/springsource/pizzashop/domain/BaseDataOnDemand_Roo_Configurable.aj
  100. +98 −0 ...ntro/pizzashop-layered/src/test/java/com/springsource/pizzashop/domain/BaseDataOnDemand_Roo_DataOnDemand.aj
  101. +13 −0 ...o/pizzashop-layered/src/test/java/com/springsource/pizzashop/domain/BaseIntegrationTest_Roo_Configurable.aj
  102. +128 −0 ...izzashop-layered/src/test/java/com/springsource/pizzashop/domain/BaseIntegrationTest_Roo_IntegrationTest.aj
  103. +13 −0 ...tro/pizzashop-layered/src/test/java/com/springsource/pizzashop/domain/PizzaDataOnDemand_Roo_Configurable.aj
  104. +109 −0 ...tro/pizzashop-layered/src/test/java/com/springsource/pizzashop/domain/PizzaDataOnDemand_Roo_DataOnDemand.aj
  105. +13 −0 .../pizzashop-layered/src/test/java/com/springsource/pizzashop/domain/PizzaIntegrationTest_Roo_Configurable.aj
  106. +128 −0 ...zzashop-layered/src/test/java/com/springsource/pizzashop/domain/PizzaIntegrationTest_Roo_IntegrationTest.aj
  107. +13 −0 ...izzashop-layered/src/test/java/com/springsource/pizzashop/domain/PizzaOrderDataOnDemand_Roo_Configurable.aj
  108. +134 −0 ...izzashop-layered/src/test/java/com/springsource/pizzashop/domain/PizzaOrderDataOnDemand_Roo_DataOnDemand.aj
  109. +13 −0 ...ashop-layered/src/test/java/com/springsource/pizzashop/domain/PizzaOrderIntegrationTest_Roo_Configurable.aj
  110. +128 −0 ...op-layered/src/test/java/com/springsource/pizzashop/domain/PizzaOrderIntegrationTest_Roo_IntegrationTest.aj
  111. +13 −0 ...o/pizzashop-layered/src/test/java/com/springsource/pizzashop/domain/ToppingDataOnDemand_Roo_Configurable.aj
  112. +98 −0 ...o/pizzashop-layered/src/test/java/com/springsource/pizzashop/domain/ToppingDataOnDemand_Roo_DataOnDemand.aj
  113. +13 −0 ...izzashop-layered/src/test/java/com/springsource/pizzashop/domain/ToppingIntegrationTest_Roo_Configurable.aj
  114. +128 −0 ...ashop-layered/src/test/java/com/springsource/pizzashop/domain/ToppingIntegrationTest_Roo_IntegrationTest.aj
View
102 ...1-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/BaseController_Roo_Controller.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;
+ }
+
+}
View
95 ...ro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/BaseController_Roo_Controller_Json.aj
@@ -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);
+ }
+
+}
View
106 ...-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/PizzaController_Roo_Controller.aj
@@ -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;
+ }
+
+}
View
95 ...o/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/PizzaController_Roo_Controller_Json.aj
@@ -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.PizzaController;
+import com.springsource.pizzashop.domain.Pizza;
+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 PizzaController_Roo_Controller_Json {
+
+ @RequestMapping(value = "/{id}", headers = "Accept=application/json")
+ @ResponseBody
+ public ResponseEntity<String> PizzaController.showJson(@PathVariable("id") Long id) {
+ Pizza pizza = Pizza.findPizza(id);
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json; charset=utf-8");
+ if (pizza == null) {
+ return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
+ }
+ return new ResponseEntity<String>(pizza.toJson(), headers, HttpStatus.OK);
+ }
+
+ @RequestMapping(headers = "Accept=application/json")
+ @ResponseBody
+ public ResponseEntity<String> PizzaController.listJson() {
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json; charset=utf-8");
+ List<Pizza> result = Pizza.findAllPizzas();
+ return new ResponseEntity<String>(Pizza.toJsonArray(result), headers, HttpStatus.OK);
+ }
+
+ @RequestMapping(method = RequestMethod.POST, headers = "Accept=application/json")
+ public ResponseEntity<String> PizzaController.createFromJson(@RequestBody String json) {
+ Pizza pizza = Pizza.fromJsonToPizza(json);
+ pizza.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> PizzaController.createFromJsonArray(@RequestBody String json) {
+ for (Pizza pizza: Pizza.fromJsonArrayToPizzas(json)) {
+ pizza.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> PizzaController.updateFromJson(@RequestBody String json) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json");
+ Pizza pizza = Pizza.fromJsonToPizza(json);
+ if (pizza.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> PizzaController.updateFromJsonArray(@RequestBody String json) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json");
+ for (Pizza pizza: Pizza.fromJsonArrayToPizzas(json)) {
+ if (pizza.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> PizzaController.deleteFromJson(@PathVariable("id") Long id) {
+ Pizza pizza = Pizza.findPizza(id);
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json");
+ if (pizza == null) {
+ return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
+ }
+ pizza.remove();
+ return new ResponseEntity<String>(headers, HttpStatus.OK);
+ }
+
+}
View
124 ...o/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/PizzaOrderController_Roo_Controller.aj
@@ -0,0 +1,124 @@
+// 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.PizzaOrderController;
+import com.springsource.pizzashop.domain.Pizza;
+import com.springsource.pizzashop.domain.PizzaOrder;
+import com.springsource.pizzashop.domain.PizzaOrderPk;
+import java.io.UnsupportedEncodingException;
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import org.joda.time.format.DateTimeFormat;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.i18n.LocaleContextHolder;
+import org.springframework.core.convert.ConversionService;
+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 PizzaOrderController_Roo_Controller {
+
+ private ConversionService PizzaOrderController.conversionService;
+
+ @Autowired
+ public PizzaOrderController.new(ConversionService conversionService) {
+ super();
+ this.conversionService = conversionService;
+ }
+
+ @RequestMapping(method = RequestMethod.POST, produces = "text/html")
+ public String PizzaOrderController.create(@Valid PizzaOrder pizzaOrder, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
+ if (bindingResult.hasErrors()) {
+ populateEditForm(uiModel, pizzaOrder);
+ return "pizzaorders/create";
+ }
+ uiModel.asMap().clear();
+ pizzaOrder.persist();
+ return "redirect:/pizzaorders/" + encodeUrlPathSegment(conversionService.convert(pizzaOrder.getId(), String.class), httpServletRequest);
+ }
+
+ @RequestMapping(params = "form", produces = "text/html")
+ public String PizzaOrderController.createForm(Model uiModel) {
+ populateEditForm(uiModel, new PizzaOrder());
+ return "pizzaorders/create";
+ }
+
+ @RequestMapping(value = "/{id}", produces = "text/html")
+ public String PizzaOrderController.show(@PathVariable("id") PizzaOrderPk id, Model uiModel) {
+ addDateTimeFormatPatterns(uiModel);
+ uiModel.addAttribute("pizzaorder", PizzaOrder.findPizzaOrder(id));
+ uiModel.addAttribute("itemId", conversionService.convert(id, String.class));
+ return "pizzaorders/show";
+ }
+
+ @RequestMapping(produces = "text/html")
+ public String PizzaOrderController.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("pizzaorders", PizzaOrder.findPizzaOrderEntries(firstResult, sizeNo));
+ float nrOfPages = (float) PizzaOrder.countPizzaOrders() / sizeNo;
+ uiModel.addAttribute("maxPages", (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages));
+ } else {
+ uiModel.addAttribute("pizzaorders", PizzaOrder.findAllPizzaOrders());
+ }
+ addDateTimeFormatPatterns(uiModel);
+ return "pizzaorders/list";
+ }
+
+ @RequestMapping(method = RequestMethod.PUT, produces = "text/html")
+ public String PizzaOrderController.update(@Valid PizzaOrder pizzaOrder, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
+ if (bindingResult.hasErrors()) {
+ populateEditForm(uiModel, pizzaOrder);
+ return "pizzaorders/update";
+ }
+ uiModel.asMap().clear();
+ pizzaOrder.merge();
+ return "redirect:/pizzaorders/" + encodeUrlPathSegment(conversionService.convert(pizzaOrder.getId(), String.class), httpServletRequest);
+ }
+
+ @RequestMapping(value = "/{id}", params = "form", produces = "text/html")
+ public String PizzaOrderController.updateForm(@PathVariable("id") PizzaOrderPk id, Model uiModel) {
+ populateEditForm(uiModel, PizzaOrder.findPizzaOrder(id));
+ return "pizzaorders/update";
+ }
+
+ @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
+ public String PizzaOrderController.delete(@PathVariable("id") PizzaOrderPk id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
+ PizzaOrder pizzaOrder = PizzaOrder.findPizzaOrder(id);
+ pizzaOrder.remove();
+ uiModel.asMap().clear();
+ uiModel.addAttribute("page", (page == null) ? "1" : page.toString());
+ uiModel.addAttribute("size", (size == null) ? "10" : size.toString());
+ return "redirect:/pizzaorders";
+ }
+
+ void PizzaOrderController.addDateTimeFormatPatterns(Model uiModel) {
+ uiModel.addAttribute("pizzaOrder_deliverydate_date_format", DateTimeFormat.patternForStyle("M-", LocaleContextHolder.getLocale()));
+ }
+
+ void PizzaOrderController.populateEditForm(Model uiModel, PizzaOrder pizzaOrder) {
+ uiModel.addAttribute("pizzaOrder", pizzaOrder);
+ addDateTimeFormatPatterns(uiModel);
+ uiModel.addAttribute("pizzas", Pizza.findAllPizzas());
+ }
+
+ String PizzaOrderController.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;
+ }
+
+}
View
96 ...zashop-activerecord/src/main/java/com/springsource/pizzashop/PizzaOrderController_Roo_Controller_Json.aj
@@ -0,0 +1,96 @@
+// 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.PizzaOrderController;
+import com.springsource.pizzashop.domain.PizzaOrder;
+import com.springsource.pizzashop.domain.PizzaOrderPk;
+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 PizzaOrderController_Roo_Controller_Json {
+
+ @RequestMapping(value = "/{id}", headers = "Accept=application/json")
+ @ResponseBody
+ public ResponseEntity<String> PizzaOrderController.showJson(@PathVariable("id") PizzaOrderPk id) {
+ PizzaOrder pizzaOrder = PizzaOrder.findPizzaOrder(id);
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json; charset=utf-8");
+ if (pizzaOrder == null) {
+ return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
+ }
+ return new ResponseEntity<String>(pizzaOrder.toJson(), headers, HttpStatus.OK);
+ }
+
+ @RequestMapping(headers = "Accept=application/json")
+ @ResponseBody
+ public ResponseEntity<String> PizzaOrderController.listJson() {
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json; charset=utf-8");
+ List<PizzaOrder> result = PizzaOrder.findAllPizzaOrders();
+ return new ResponseEntity<String>(PizzaOrder.toJsonArray(result), headers, HttpStatus.OK);
+ }
+
+ @RequestMapping(method = RequestMethod.POST, headers = "Accept=application/json")
+ public ResponseEntity<String> PizzaOrderController.createFromJson(@RequestBody String json) {
+ PizzaOrder pizzaOrder = PizzaOrder.fromJsonToPizzaOrder(json);
+ pizzaOrder.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> PizzaOrderController.createFromJsonArray(@RequestBody String json) {
+ for (PizzaOrder pizzaOrder: PizzaOrder.fromJsonArrayToPizzaOrders(json)) {
+ pizzaOrder.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> PizzaOrderController.updateFromJson(@RequestBody String json) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json");
+ PizzaOrder pizzaOrder = PizzaOrder.fromJsonToPizzaOrder(json);
+ if (pizzaOrder.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> PizzaOrderController.updateFromJsonArray(@RequestBody String json) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json");
+ for (PizzaOrder pizzaOrder: PizzaOrder.fromJsonArrayToPizzaOrders(json)) {
+ if (pizzaOrder.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> PizzaOrderController.deleteFromJson(@PathVariable("id") PizzaOrderPk id) {
+ PizzaOrder pizzaOrder = PizzaOrder.findPizzaOrder(id);
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json");
+ if (pizzaOrder == null) {
+ return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
+ }
+ pizzaOrder.remove();
+ return new ResponseEntity<String>(headers, HttpStatus.OK);
+ }
+
+}
View
102 ...ntro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/ToppingController_Roo_Controller.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.ToppingController;
+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 ToppingController_Roo_Controller {
+
+ @RequestMapping(method = RequestMethod.POST, produces = "text/html")
+ public String ToppingController.create(@Valid Topping topping, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
+ if (bindingResult.hasErrors()) {
+ populateEditForm(uiModel, topping);
+ return "toppings/create";
+ }
+ uiModel.asMap().clear();
+ topping.persist();
+ return "redirect:/toppings/" + encodeUrlPathSegment(topping.getId().toString(), httpServletRequest);
+ }
+
+ @RequestMapping(params = "form", produces = "text/html")
+ public String ToppingController.createForm(Model uiModel) {
+ populateEditForm(uiModel, new Topping());
+ return "toppings/create";
+ }
+
+ @RequestMapping(value = "/{id}", produces = "text/html")
+ public String ToppingController.show(@PathVariable("id") Long id, Model uiModel) {
+ uiModel.addAttribute("topping", Topping.findTopping(id));
+ uiModel.addAttribute("itemId", id);
+ return "toppings/show";
+ }
+
+ @RequestMapping(produces = "text/html")
+ public String ToppingController.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("toppings", Topping.findToppingEntries(firstResult, sizeNo));
+ float nrOfPages = (float) Topping.countToppings() / sizeNo;
+ uiModel.addAttribute("maxPages", (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages));
+ } else {
+ uiModel.addAttribute("toppings", Topping.findAllToppings());
+ }
+ return "toppings/list";
+ }
+
+ @RequestMapping(method = RequestMethod.PUT, produces = "text/html")
+ public String ToppingController.update(@Valid Topping topping, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
+ if (bindingResult.hasErrors()) {
+ populateEditForm(uiModel, topping);
+ return "toppings/update";
+ }
+ uiModel.asMap().clear();
+ topping.merge();
+ return "redirect:/toppings/" + encodeUrlPathSegment(topping.getId().toString(), httpServletRequest);
+ }
+
+ @RequestMapping(value = "/{id}", params = "form", produces = "text/html")
+ public String ToppingController.updateForm(@PathVariable("id") Long id, Model uiModel) {
+ populateEditForm(uiModel, Topping.findTopping(id));
+ return "toppings/update";
+ }
+
+ @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
+ public String ToppingController.delete(@PathVariable("id") Long id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
+ Topping topping = Topping.findTopping(id);
+ topping.remove();
+ uiModel.asMap().clear();
+ uiModel.addAttribute("page", (page == null) ? "1" : page.toString());
+ uiModel.addAttribute("size", (size == null) ? "10" : size.toString());
+ return "redirect:/toppings";
+ }
+
+ void ToppingController.populateEditForm(Model uiModel, Topping topping) {
+ uiModel.addAttribute("topping", topping);
+ }
+
+ String ToppingController.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;
+ }
+
+}
View
95 ...pizzashop-activerecord/src/main/java/com/springsource/pizzashop/ToppingController_Roo_Controller_Json.aj
@@ -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.ToppingController;
+import com.springsource.pizzashop.domain.Topping;
+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 ToppingController_Roo_Controller_Json {
+
+ @RequestMapping(value = "/{id}", headers = "Accept=application/json")
+ @ResponseBody
+ public ResponseEntity<String> ToppingController.showJson(@PathVariable("id") Long id) {
+ Topping topping = Topping.findTopping(id);
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json; charset=utf-8");
+ if (topping == null) {
+ return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
+ }
+ return new ResponseEntity<String>(topping.toJson(), headers, HttpStatus.OK);
+ }
+
+ @RequestMapping(headers = "Accept=application/json")
+ @ResponseBody
+ public ResponseEntity<String> ToppingController.listJson() {
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json; charset=utf-8");
+ List<Topping> result = Topping.findAllToppings();
+ return new ResponseEntity<String>(Topping.toJsonArray(result), headers, HttpStatus.OK);
+ }
+
+ @RequestMapping(method = RequestMethod.POST, headers = "Accept=application/json")
+ public ResponseEntity<String> ToppingController.createFromJson(@RequestBody String json) {
+ Topping topping = Topping.fromJsonToTopping(json);
+ topping.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> ToppingController.createFromJsonArray(@RequestBody String json) {
+ for (Topping topping: Topping.fromJsonArrayToToppings(json)) {
+ topping.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> ToppingController.updateFromJson(@RequestBody String json) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json");
+ Topping topping = Topping.fromJsonToTopping(json);
+ if (topping.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> ToppingController.updateFromJsonArray(@RequestBody String json) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json");
+ for (Topping topping: Topping.fromJsonArrayToToppings(json)) {
+ if (topping.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> ToppingController.deleteFromJson(@PathVariable("id") Long id) {
+ Topping topping = Topping.findTopping(id);
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json");
+ if (topping == null) {
+ return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
+ }
+ topping.remove();
+ return new ResponseEntity<String>(headers, HttpStatus.OK);
+ }
+
+}
View
13 ...01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_Configurable.aj
@@ -0,0 +1,13 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Base;
+import org.springframework.beans.factory.annotation.Configurable;
+
+privileged aspect Base_Roo_Configurable {
+
+ declare @type: Base: @Configurable;
+
+}
View
18 ...ter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_JavaBean.aj
@@ -0,0 +1,18 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Base;
+
+privileged aspect Base_Roo_JavaBean {
+
+ public String Base.getName() {
+ return this.name;
+ }
+
+ public void Base.setName(String name) {
+ this.name = name;
+ }
+
+}
View
77 ...ntro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_Jpa_ActiveRecord.aj
@@ -0,0 +1,77 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Base;
+import java.util.List;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import org.springframework.transaction.annotation.Transactional;
+
+privileged aspect Base_Roo_Jpa_ActiveRecord {
+
+ @PersistenceContext
+ transient EntityManager Base.entityManager;
+
+ public static final EntityManager Base.entityManager() {
+ EntityManager em = new Base().entityManager;
+ if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
+ return em;
+ }
+
+ public static long Base.countBases() {
+ return entityManager().createQuery("SELECT COUNT(o) FROM Base o", Long.class).getSingleResult();
+ }
+
+ public static List<Base> Base.findAllBases() {
+ return entityManager().createQuery("SELECT o FROM Base o", Base.class).getResultList();
+ }
+
+ public static Base Base.findBase(Long id) {
+ if (id == null) return null;
+ return entityManager().find(Base.class, id);
+ }
+
+ public static List<Base> Base.findBaseEntries(int firstResult, int maxResults) {
+ return entityManager().createQuery("SELECT o FROM Base o", Base.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
+ }
+
+ @Transactional
+ public void Base.persist() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ this.entityManager.persist(this);
+ }
+
+ @Transactional
+ public void Base.remove() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ if (this.entityManager.contains(this)) {
+ this.entityManager.remove(this);
+ } else {
+ Base attached = Base.findBase(this.id);
+ this.entityManager.remove(attached);
+ }
+ }
+
+ @Transactional
+ public void Base.flush() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ this.entityManager.flush();
+ }
+
+ @Transactional
+ public void Base.clear() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ this.entityManager.clear();
+ }
+
+ @Transactional
+ public Base Base.merge() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ Base merged = this.entityManager.merge(this);
+ this.entityManager.flush();
+ return merged;
+ }
+
+}
View
43 ...r-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_Jpa_Entity.aj
@@ -0,0 +1,43 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Base;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Version;
+
+privileged aspect Base_Roo_Jpa_Entity {
+
+ declare @type: Base: @Entity;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "id")
+ private Long Base.id;
+
+ @Version
+ @Column(name = "version")
+ private Integer Base.version;
+
+ public Long Base.getId() {
+ return this.id;
+ }
+
+ public void Base.setId(Long id) {
+ this.id = id;
+ }
+
+ public Integer Base.getVersion() {
+ return this.version;
+ }
+
+ public void Base.setVersion(Integer version) {
+ this.version = version;
+ }
+
+}
View
31 chapter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_Json.aj
@@ -0,0 +1,31 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Base;
+import flexjson.JSONDeserializer;
+import flexjson.JSONSerializer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+privileged aspect Base_Roo_Json {
+
+ public String Base.toJson() {
+ return new JSONSerializer().exclude("*.class").deepSerialize(this);
+ }
+
+ public static Base Base.fromJsonToBase(String json) {
+ return new JSONDeserializer<Base>().use(null, Base.class).deserialize(json);
+ }
+
+ public static String Base.toJsonArray(Collection<Base> collection) {
+ return new JSONSerializer().exclude("*.class").deepSerialize(collection);
+ }
+
+ public static Collection<Base> Base.fromJsonArrayToBases(String json) {
+ return new JSONDeserializer<List<Base>>().use(null, ArrayList.class).use("values", Base.class).deserialize(json);
+ }
+
+}
View
16 ...ter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Base_Roo_ToString.aj
@@ -0,0 +1,16 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Base;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+privileged aspect Base_Roo_ToString {
+
+ public String Base.toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ }
+
+}
View
13 .../pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Configurable.aj
@@ -0,0 +1,13 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.PizzaOrderPk;
+import org.springframework.beans.factory.annotation.Configurable;
+
+privileged aspect PizzaOrderPk_Roo_Configurable {
+
+ declare @type: PizzaOrderPk: @Configurable;
+
+}
View
27 ...-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Equals.aj
@@ -0,0 +1,27 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.PizzaOrderPk;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+privileged aspect PizzaOrderPk_Roo_Equals {
+
+ public boolean PizzaOrderPk.equals(Object obj) {
+ if (!(obj instanceof PizzaOrderPk)) {
+ return false;
+ }
+ if (this == obj) {
+ return true;
+ }
+ PizzaOrderPk rhs = (PizzaOrderPk) obj;
+ return new EqualsBuilder().append(shopCity, rhs.shopCity).append(shopCountry, rhs.shopCountry).append(shopName, rhs.shopName).isEquals();
+ }
+
+ public int PizzaOrderPk.hashCode() {
+ return new HashCodeBuilder().append(shopCity).append(shopCountry).append(shopName).toHashCode();
+ }
+
+}
View
36 ...ro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Identifier.aj
@@ -0,0 +1,36 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.PizzaOrderPk;
+import javax.persistence.Embeddable;
+
+privileged aspect PizzaOrderPk_Roo_Identifier {
+
+ declare @type: PizzaOrderPk: @Embeddable;
+
+ public PizzaOrderPk.new(String shopCountry, String shopCity, String shopName) {
+ super();
+ this.shopCountry = shopCountry;
+ this.shopCity = shopCity;
+ this.shopName = shopName;
+ }
+
+ private PizzaOrderPk.new() {
+ super();
+ }
+
+ public String PizzaOrderPk.getShopCountry() {
+ return shopCountry;
+ }
+
+ public String PizzaOrderPk.getShopCity() {
+ return shopCity;
+ }
+
+ public String PizzaOrderPk.getShopName() {
+ return shopName;
+ }
+
+}
View
31 ...01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Json.aj
@@ -0,0 +1,31 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.PizzaOrderPk;
+import flexjson.JSONDeserializer;
+import flexjson.JSONSerializer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+privileged aspect PizzaOrderPk_Roo_Json {
+
+ public String PizzaOrderPk.toJson() {
+ return new JSONSerializer().exclude("*.class").serialize(this);
+ }
+
+ public static PizzaOrderPk PizzaOrderPk.fromJsonToPizzaOrderPk(String json) {
+ return new JSONDeserializer<PizzaOrderPk>().use(null, PizzaOrderPk.class).deserialize(json);
+ }
+
+ public static String PizzaOrderPk.toJsonArray(Collection<PizzaOrderPk> collection) {
+ return new JSONSerializer().exclude("*.class").serialize(collection);
+ }
+
+ public static Collection<PizzaOrderPk> PizzaOrderPk.fromJsonArrayToPizzaOrderPks(String json) {
+ return new JSONDeserializer<List<PizzaOrderPk>>().use(null, ArrayList.class).use("values", PizzaOrderPk.class).deserialize(json);
+ }
+
+}
View
15 .../pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_Serializable.aj
@@ -0,0 +1,15 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.PizzaOrderPk;
+import java.io.Serializable;
+
+privileged aspect PizzaOrderPk_Roo_Serializable {
+
+ declare parents: PizzaOrderPk implements Serializable;
+
+ private static final long PizzaOrderPk.serialVersionUID = 1L;
+
+}
View
16 ...ntro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrderPk_Roo_ToString.aj
@@ -0,0 +1,16 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.PizzaOrderPk;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+privileged aspect PizzaOrderPk_Roo_ToString {
+
+ public String PizzaOrderPk.toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ }
+
+}
View
13 ...ro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Configurable.aj
@@ -0,0 +1,13 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.PizzaOrder;
+import org.springframework.beans.factory.annotation.Configurable;
+
+privileged aspect PizzaOrder_Roo_Configurable {
+
+ declare @type: PizzaOrder: @Configurable;
+
+}
View
54 ...-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_JavaBean.aj
@@ -0,0 +1,54 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Pizza;
+import com.springsource.pizzashop.domain.PizzaOrder;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.Set;
+
+privileged aspect PizzaOrder_Roo_JavaBean {
+
+ public String PizzaOrder.getName() {
+ return this.name;
+ }
+
+ public void PizzaOrder.setName(String name) {
+ this.name = name;
+ }
+
+ public String PizzaOrder.getAddress() {
+ return this.address;
+ }
+
+ public void PizzaOrder.setAddress(String address) {
+ this.address = address;
+ }
+
+ public BigDecimal PizzaOrder.getTotal() {
+ return this.total;
+ }
+
+ public void PizzaOrder.setTotal(BigDecimal total) {
+ this.total = total;
+ }
+
+ public Date PizzaOrder.getDeliveryDate() {
+ return this.deliveryDate;
+ }
+
+ public void PizzaOrder.setDeliveryDate(Date deliveryDate) {
+ this.deliveryDate = deliveryDate;
+ }
+
+ public Set<Pizza> PizzaOrder.getPizzas() {
+ return this.pizzas;
+ }
+
+ public void PizzaOrder.setPizzas(Set<Pizza> pizzas) {
+ this.pizzas = pizzas;
+ }
+
+}
View
78 ...izzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Jpa_ActiveRecord.aj
@@ -0,0 +1,78 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.PizzaOrder;
+import com.springsource.pizzashop.domain.PizzaOrderPk;
+import java.util.List;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import org.springframework.transaction.annotation.Transactional;
+
+privileged aspect PizzaOrder_Roo_Jpa_ActiveRecord {
+
+ @PersistenceContext
+ transient EntityManager PizzaOrder.entityManager;
+
+ public static final EntityManager PizzaOrder.entityManager() {
+ EntityManager em = new PizzaOrder().entityManager;
+ if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
+ return em;
+ }
+
+ public static long PizzaOrder.countPizzaOrders() {
+ return entityManager().createQuery("SELECT COUNT(o) FROM PizzaOrder o", Long.class).getSingleResult();
+ }
+
+ public static List<PizzaOrder> PizzaOrder.findAllPizzaOrders() {
+ return entityManager().createQuery("SELECT o FROM PizzaOrder o", PizzaOrder.class).getResultList();
+ }
+
+ public static PizzaOrder PizzaOrder.findPizzaOrder(PizzaOrderPk id) {
+ if (id == null) return null;
+ return entityManager().find(PizzaOrder.class, id);
+ }
+
+ public static List<PizzaOrder> PizzaOrder.findPizzaOrderEntries(int firstResult, int maxResults) {
+ return entityManager().createQuery("SELECT o FROM PizzaOrder o", PizzaOrder.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
+ }
+
+ @Transactional
+ public void PizzaOrder.persist() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ this.entityManager.persist(this);
+ }
+
+ @Transactional
+ public void PizzaOrder.remove() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ if (this.entityManager.contains(this)) {
+ this.entityManager.remove(this);
+ } else {
+ PizzaOrder attached = PizzaOrder.findPizzaOrder(this.id);
+ this.entityManager.remove(attached);
+ }
+ }
+
+ @Transactional
+ public void PizzaOrder.flush() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ this.entityManager.flush();
+ }
+
+ @Transactional
+ public void PizzaOrder.clear() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ this.entityManager.clear();
+ }
+
+ @Transactional
+ public PizzaOrder PizzaOrder.merge() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ PizzaOrder merged = this.entityManager.merge(this);
+ this.entityManager.flush();
+ return merged;
+ }
+
+}
View
40 ...ntro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Jpa_Entity.aj
@@ -0,0 +1,40 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.PizzaOrder;
+import com.springsource.pizzashop.domain.PizzaOrderPk;
+import javax.persistence.Column;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.Version;
+
+privileged aspect PizzaOrder_Roo_Jpa_Entity {
+
+ declare @type: PizzaOrder: @Entity;
+
+ @EmbeddedId
+ private PizzaOrderPk PizzaOrder.id;
+
+ @Version
+ @Column(name = "version")
+ private Integer PizzaOrder.version;
+
+ public PizzaOrderPk PizzaOrder.getId() {
+ return this.id;
+ }
+
+ public void PizzaOrder.setId(PizzaOrderPk id) {
+ this.id = id;
+ }
+
+ public Integer PizzaOrder.getVersion() {
+ return this.version;
+ }
+
+ public void PizzaOrder.setVersion(Integer version) {
+ this.version = version;
+ }
+
+}
View
31 ...r-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_Json.aj
@@ -0,0 +1,31 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.PizzaOrder;
+import flexjson.JSONDeserializer;
+import flexjson.JSONSerializer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+privileged aspect PizzaOrder_Roo_Json {
+
+ public String PizzaOrder.toJson() {
+ return new JSONSerializer().exclude("*.class").deepSerialize(this);
+ }
+
+ public static PizzaOrder PizzaOrder.fromJsonToPizzaOrder(String json) {
+ return new JSONDeserializer<PizzaOrder>().use(null, PizzaOrder.class).deserialize(json);
+ }
+
+ public static String PizzaOrder.toJsonArray(Collection<PizzaOrder> collection) {
+ return new JSONSerializer().exclude("*.class").deepSerialize(collection);
+ }
+
+ public static Collection<PizzaOrder> PizzaOrder.fromJsonArrayToPizzaOrders(String json) {
+ return new JSONDeserializer<List<PizzaOrder>>().use(null, ArrayList.class).use("values", PizzaOrder.class).deserialize(json);
+ }
+
+}
View
16 ...-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/PizzaOrder_Roo_ToString.aj
@@ -0,0 +1,16 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.PizzaOrder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+privileged aspect PizzaOrder_Roo_ToString {
+
+ public String PizzaOrder.toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ }
+
+}
View
13 ...1-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_Configurable.aj
@@ -0,0 +1,13 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Pizza;
+import org.springframework.beans.factory.annotation.Configurable;
+
+privileged aspect Pizza_Roo_Configurable {
+
+ declare @type: Pizza: @Configurable;
+
+}
View
46 ...er-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_JavaBean.aj
@@ -0,0 +1,46 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Base;
+import com.springsource.pizzashop.domain.Pizza;
+import com.springsource.pizzashop.domain.Topping;
+import java.math.BigDecimal;
+import java.util.Set;
+
+privileged aspect Pizza_Roo_JavaBean {
+
+ public String Pizza.getName() {
+ return this.name;
+ }
+
+ public void Pizza.setName(String name) {
+ this.name = name;
+ }
+
+ public BigDecimal Pizza.getPrice() {
+ return this.price;
+ }
+
+ public void Pizza.setPrice(BigDecimal price) {
+ this.price = price;
+ }
+
+ public Set<Topping> Pizza.getToppings() {
+ return this.toppings;
+ }
+
+ public void Pizza.setToppings(Set<Topping> toppings) {
+ this.toppings = toppings;
+ }
+
+ public Base Pizza.getBase() {
+ return this.base;
+ }
+
+ public void Pizza.setBase(Base base) {
+ this.base = base;
+ }
+
+}
View
77 ...tro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_Jpa_ActiveRecord.aj
@@ -0,0 +1,77 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Pizza;
+import java.util.List;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import org.springframework.transaction.annotation.Transactional;
+
+privileged aspect Pizza_Roo_Jpa_ActiveRecord {
+
+ @PersistenceContext
+ transient EntityManager Pizza.entityManager;
+
+ public static final EntityManager Pizza.entityManager() {
+ EntityManager em = new Pizza().entityManager;
+ if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
+ return em;
+ }
+
+ public static long Pizza.countPizzas() {
+ return entityManager().createQuery("SELECT COUNT(o) FROM Pizza o", Long.class).getSingleResult();
+ }
+
+ public static List<Pizza> Pizza.findAllPizzas() {
+ return entityManager().createQuery("SELECT o FROM Pizza o", Pizza.class).getResultList();
+ }
+
+ public static Pizza Pizza.findPizza(Long id) {
+ if (id == null) return null;
+ return entityManager().find(Pizza.class, id);
+ }
+
+ public static List<Pizza> Pizza.findPizzaEntries(int firstResult, int maxResults) {
+ return entityManager().createQuery("SELECT o FROM Pizza o", Pizza.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
+ }
+
+ @Transactional
+ public void Pizza.persist() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ this.entityManager.persist(this);
+ }
+
+ @Transactional
+ public void Pizza.remove() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ if (this.entityManager.contains(this)) {
+ this.entityManager.remove(this);
+ } else {
+ Pizza attached = Pizza.findPizza(this.id);
+ this.entityManager.remove(attached);
+ }
+ }
+
+ @Transactional
+ public void Pizza.flush() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ this.entityManager.flush();
+ }
+
+ @Transactional
+ public void Pizza.clear() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ this.entityManager.clear();
+ }
+
+ @Transactional
+ public Pizza Pizza.merge() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ Pizza merged = this.entityManager.merge(this);
+ this.entityManager.flush();
+ return merged;
+ }
+
+}
View
43 ...-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_Jpa_Entity.aj
@@ -0,0 +1,43 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Pizza;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Version;
+
+privileged aspect Pizza_Roo_Jpa_Entity {
+
+ declare @type: Pizza: @Entity;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "id")
+ private Long Pizza.id;
+
+ @Version
+ @Column(name = "version")
+ private Integer Pizza.version;
+
+ public Long Pizza.getId() {
+ return this.id;
+ }
+
+ public void Pizza.setId(Long id) {
+ this.id = id;
+ }
+
+ public Integer Pizza.getVersion() {
+ return this.version;
+ }
+
+ public void Pizza.setVersion(Integer version) {
+ this.version = version;
+ }
+
+}
View
31 chapter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_Json.aj
@@ -0,0 +1,31 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Pizza;
+import flexjson.JSONDeserializer;
+import flexjson.JSONSerializer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+privileged aspect Pizza_Roo_Json {
+
+ public String Pizza.toJson() {
+ return new JSONSerializer().exclude("*.class").deepSerialize(this);
+ }
+
+ public static Pizza Pizza.fromJsonToPizza(String json) {
+ return new JSONDeserializer<Pizza>().use(null, Pizza.class).deserialize(json);
+ }
+
+ public static String Pizza.toJsonArray(Collection<Pizza> collection) {
+ return new JSONSerializer().exclude("*.class").deepSerialize(collection);
+ }
+
+ public static Collection<Pizza> Pizza.fromJsonArrayToPizzas(String json) {
+ return new JSONDeserializer<List<Pizza>>().use(null, ArrayList.class).use("values", Pizza.class).deserialize(json);
+ }
+
+}
View
16 ...er-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Pizza_Roo_ToString.aj
@@ -0,0 +1,16 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Pizza;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+privileged aspect Pizza_Roo_ToString {
+
+ public String Pizza.toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ }
+
+}
View
13 ...intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Configurable.aj
@@ -0,0 +1,13 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Topping;
+import org.springframework.beans.factory.annotation.Configurable;
+
+privileged aspect Topping_Roo_Configurable {
+
+ declare @type: Topping: @Configurable;
+
+}
View
18 ...-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_JavaBean.aj
@@ -0,0 +1,18 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Topping;
+
+privileged aspect Topping_Roo_JavaBean {
+
+ public String Topping.getName() {
+ return this.name;
+ }
+
+ public void Topping.setName(String name) {
+ this.name = name;
+ }
+
+}
View
77 ...o/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Jpa_ActiveRecord.aj
@@ -0,0 +1,77 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Topping;
+import java.util.List;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import org.springframework.transaction.annotation.Transactional;
+
+privileged aspect Topping_Roo_Jpa_ActiveRecord {
+
+ @PersistenceContext
+ transient EntityManager Topping.entityManager;
+
+ public static final EntityManager Topping.entityManager() {
+ EntityManager em = new Topping().entityManager;
+ if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
+ return em;
+ }
+
+ public static long Topping.countToppings() {
+ return entityManager().createQuery("SELECT COUNT(o) FROM Topping o", Long.class).getSingleResult();
+ }
+
+ public static List<Topping> Topping.findAllToppings() {
+ return entityManager().createQuery("SELECT o FROM Topping o", Topping.class).getResultList();
+ }
+
+ public static Topping Topping.findTopping(Long id) {
+ if (id == null) return null;
+ return entityManager().find(Topping.class, id);
+ }
+
+ public static List<Topping> Topping.findToppingEntries(int firstResult, int maxResults) {
+ return entityManager().createQuery("SELECT o FROM Topping o", Topping.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
+ }
+
+ @Transactional
+ public void Topping.persist() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ this.entityManager.persist(this);
+ }
+
+ @Transactional
+ public void Topping.remove() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ if (this.entityManager.contains(this)) {
+ this.entityManager.remove(this);
+ } else {
+ Topping attached = Topping.findTopping(this.id);
+ this.entityManager.remove(attached);
+ }
+ }
+
+ @Transactional
+ public void Topping.flush() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ this.entityManager.flush();
+ }
+
+ @Transactional
+ public void Topping.clear() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ this.entityManager.clear();
+ }
+
+ @Transactional
+ public Topping Topping.merge() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ Topping merged = this.entityManager.merge(this);
+ this.entityManager.flush();
+ return merged;
+ }
+
+}
View
43 ...1-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Jpa_Entity.aj
@@ -0,0 +1,43 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Topping;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Version;
+
+privileged aspect Topping_Roo_Jpa_Entity {
+
+ declare @type: Topping: @Entity;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "id")
+ private Long Topping.id;
+
+ @Version
+ @Column(name = "version")
+ private Integer Topping.version;
+
+ public Long Topping.getId() {
+ return this.id;
+ }
+
+ public void Topping.setId(Long id) {
+ this.id = id;
+ }
+
+ public Integer Topping.getVersion() {
+ return this.version;
+ }
+
+ public void Topping.setVersion(Integer version) {
+ this.version = version;
+ }
+
+}
View
31 chapter-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_Json.aj
@@ -0,0 +1,31 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Topping;
+import flexjson.JSONDeserializer;
+import flexjson.JSONSerializer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+privileged aspect Topping_Roo_Json {
+
+ public String Topping.toJson() {
+ return new JSONSerializer().exclude("*.class").deepSerialize(this);
+ }
+
+ public static Topping Topping.fromJsonToTopping(String json) {
+ return new JSONDeserializer<Topping>().use(null, Topping.class).deserialize(json);
+ }
+
+ public static String Topping.toJsonArray(Collection<Topping> collection) {
+ return new JSONSerializer().exclude("*.class").deepSerialize(collection);
+ }
+
+ public static Collection<Topping> Topping.fromJsonArrayToToppings(String json) {
+ return new JSONDeserializer<List<Topping>>().use(null, ArrayList.class).use("values", Topping.class).deserialize(json);
+ }
+
+}
View
16 ...-01-intro/pizzashop-activerecord/src/main/java/com/springsource/pizzashop/domain/Topping_Roo_ToString.aj
@@ -0,0 +1,16 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Topping;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+privileged aspect Topping_Roo_ToString {
+
+ public String Topping.toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ }
+
+}
View
155 ...ain/java/com/springsource/pizzashop/web/ApplicationConversionServiceFactoryBean_Roo_ConversionService.aj
@@ -0,0 +1,155 @@
+// 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.web;
+
+import com.springsource.pizzashop.domain.Base;
+import com.springsource.pizzashop.domain.Pizza;
+import com.springsource.pizzashop.domain.PizzaOrder;
+import com.springsource.pizzashop.domain.PizzaOrderPk;
+import com.springsource.pizzashop.domain.Topping;
+import com.springsource.pizzashop.web.ApplicationConversionServiceFactoryBean;
+import org.apache.commons.codec.binary.Base64;
+import org.springframework.beans.factory.annotation.Configurable;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.format.FormatterRegistry;
+
+privileged aspect ApplicationConversionServiceFactoryBean_Roo_ConversionService {
+
+ declare @type: ApplicationConversionServiceFactoryBean: @Configurable;
+
+ public Converter<Base, String> ApplicationConversionServiceFactoryBean.getBaseToStringConverter() {
+ return new org.springframework.core.convert.converter.Converter<com.springsource.pizzashop.domain.Base, java.lang.String>() {
+ public String convert(Base base) {
+ return new StringBuilder().append(base.getName()).toString();
+ }
+ };
+ }
+
+ public Converter<Long, Base> ApplicationConversionServiceFactoryBean.getIdToBaseConverter() {
+ return new org.springframework.core.convert.converter.Converter<java.lang.Long, com.springsource.pizzashop.domain.Base>() {
+ public com.springsource.pizzashop.domain.Base convert(java.lang.Long id) {
+ return Base.findBase(id);
+ }
+ };
+ }
+
+ public Converter<String, Base> ApplicationConversionServiceFactoryBean.getStringToBaseConverter() {
+ return new org.springframework.core.convert.converter.Converter<java.lang.String, com.springsource.pizzashop.domain.Base>() {
+ public com.springsource.pizzashop.domain.Base convert(String id) {
+ return getObject().convert(getObject().convert(id, Long.class), Base.class);
+ }
+ };
+ }
+
+ public Converter<Pizza, String> ApplicationConversionServiceFactoryBean.getPizzaToStringConverter() {
+ return new org.springframework.core.convert.converter.Converter<com.springsource.pizzashop.domain.Pizza, java.lang.String>() {
+ public String convert(Pizza pizza) {
+ return new StringBuilder().append(pizza.getName()).append(' ').append(pizza.getPrice()).toString();
+ }
+ };
+ }
+
+ public Converter<Long, Pizza> ApplicationConversionServiceFactoryBean.getIdToPizzaConverter() {
+ return new org.springframework.core.convert.converter.Converter<java.lang.Long, com.springsource.pizzashop.domain.Pizza>() {
+ public com.springsource.pizzashop.domain.Pizza convert(java.lang.Long id) {
+ return Pizza.findPizza(id);
+ }
+ };
+ }
+
+ public Converter<String, Pizza> ApplicationConversionServiceFactoryBean.getStringToPizzaConverter() {
+ return new org.springframework.core.convert.converter.Converter<java.lang.String, com.springsource.pizzashop.domain.Pizza>() {
+ public com.springsource.pizzashop.domain.Pizza convert(String id) {
+ return getObject().convert(getObject().convert(id, Long.class), Pizza.class);
+ }
+ };
+ }
+
+ public Converter<PizzaOrder, String> ApplicationConversionServiceFactoryBean.getPizzaOrderToStringConverter() {
+ return new org.springframework.core.convert.converter.Converter<com.springsource.pizzashop.domain.PizzaOrder, java.lang.String>() {
+ public String convert(PizzaOrder pizzaOrder) {
+ return new StringBuilder().append(pizzaOrder.getName()).append(' ').append(pizzaOrder.getAddress()).append(' ').append(pizzaOrder.getTotal()).append(' ').append(pizzaOrder.getDeliveryDate()).toString();
+ }
+ };
+ }
+
+ public Converter<PizzaOrderPk, PizzaOrder> ApplicationConversionServiceFactoryBean.getIdToPizzaOrderConverter() {
+ return new org.springframework.core.convert.converter.Converter<com.springsource.pizzashop.domain.PizzaOrderPk, com.springsource.pizzashop.domain.PizzaOrder>() {
+ public com.springsource.pizzashop.domain.PizzaOrder convert(com.springsource.pizzashop.domain.PizzaOrderPk id) {
+ return PizzaOrder.findPizzaOrder(id);
+ }
+ };
+ }
+
+ public Converter<String, PizzaOrder> ApplicationConversionServiceFactoryBean.getStringToPizzaOrderConverter() {
+ return new org.springframework.core.convert.converter.Converter<java.lang.String, com.springsource.pizzashop.domain.PizzaOrder>() {
+ public com.springsource.pizzashop.domain.PizzaOrder convert(String id) {
+ return getObject().convert(getObject().convert(id, PizzaOrderPk.class), PizzaOrder.class);
+ }
+ };
+ }
+
+ public Converter<Topping, String> ApplicationConversionServiceFactoryBean.getToppingToStringConverter() {
+ return new org.springframework.core.convert.converter.Converter<com.springsource.pizzashop.domain.Topping, java.lang.String>() {
+ public String convert(Topping topping) {
+ return new StringBuilder().append(topping.getName()).toString();
+ }
+ };
+ }
+
+ public Converter<Long, Topping> ApplicationConversionServiceFactoryBean.getIdToToppingConverter() {
+ return new org.springframework.core.convert.converter.Converter<java.lang.Long, com.springsource.pizzashop.domain.Topping>() {
+ public com.springsource.pizzashop.domain.Topping convert(java.lang.Long id) {
+ return Topping.findTopping(id);
+ }
+ };
+ }
+
+ public Converter<String, Topping> ApplicationConversionServiceFactoryBean.getStringToToppingConverter() {
+ return new org.springframework.core.convert.converter.Converter<java.lang.String, com.springsource.pizzashop.domain.Topping>() {
+ public com.springsource.pizzashop.domain.Topping convert(String id) {
+ return getObject().convert(getObject().convert(id, Long.class), Topping.class);
+ }
+ };
+ }
+
+ public Converter<String, PizzaOrderPk> ApplicationConversionServiceFactoryBean.getJsonToPizzaOrderPkConverter() {
+ return new org.springframework.core.convert.converter.Converter<java.lang.String, com.springsource.pizzashop.domain.PizzaOrderPk>() {
+ public PizzaOrderPk convert(String encodedJson) {
+ return PizzaOrderPk.fromJsonToPizzaOrderPk(new String(Base64.decodeBase64(encodedJson)));
+ }
+ };
+ }
+
+ public Converter<PizzaOrderPk, String> ApplicationConversionServiceFactoryBean.getPizzaOrderPkToJsonConverter() {
+ return new org.springframework.core.convert.converter.Converter<com.springsource.pizzashop.domain.PizzaOrderPk, java.lang.String>() {
+ public String convert(PizzaOrderPk pizzaOrderPk) {
+ return Base64.encodeBase64URLSafeString(pizzaOrderPk.toJson().getBytes());
+ }
+ };
+ }
+
+ public void ApplicationConversionServiceFactoryBean.installLabelConverters(FormatterRegistry registry) {
+ registry.addConverter(getBaseToStringConverter());
+ registry.addConverter(getIdToBaseConverter());
+ registry.addConverter(getStringToBaseConverter());
+ registry.addConverter(getPizzaToStringConverter());
+ registry.addConverter(getIdToPizzaConverter());
+ registry.addConverter(getStringToPizzaConverter());
+ registry.addConverter(getPizzaOrderToStringConverter());
+ registry.addConverter(getIdToPizzaOrderConverter());
+ registry.addConverter(getStringToPizzaOrderConverter());
+ registry.addConverter(getToppingToStringConverter());
+ registry.addConverter(getIdToToppingConverter());
+ registry.addConverter(getStringToToppingConverter());
+ registry.addConverter(getJsonToPizzaOrderPkConverter());
+ registry.addConverter(getPizzaOrderPkToJsonConverter());
+ }
+
+ public void ApplicationConversionServiceFactoryBean.afterPropertiesSet() {
+ super.afterPropertiesSet();
+ installLabelConverters(getObject());
+ }
+
+}
View
13 ...zashop-activerecord/src/test/java/com/springsource/pizzashop/domain/BaseDataOnDemand_Roo_Configurable.aj
@@ -0,0 +1,13 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.BaseDataOnDemand;
+import org.springframework.beans.factory.annotation.Configurable;
+
+privileged aspect BaseDataOnDemand_Roo_Configurable {
+
+ declare @type: BaseDataOnDemand: @Configurable;
+
+}
View
89 ...zashop-activerecord/src/test/java/com/springsource/pizzashop/domain/BaseDataOnDemand_Roo_DataOnDemand.aj
@@ -0,0 +1,89 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Base;
+import com.springsource.pizzashop.domain.BaseDataOnDemand;
+import java.security.SecureRandom;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+import org.springframework.stereotype.Component;
+
+privileged aspect BaseDataOnDemand_Roo_DataOnDemand {
+
+ declare @type: BaseDataOnDemand: @Component;
+
+ private Random BaseDataOnDemand.rnd = new SecureRandom();
+
+ private List<Base> BaseDataOnDemand.data;
+
+ public Base BaseDataOnDemand.getNewTransientBase(int index) {
+ Base obj = new Base();
+ setName(obj, index);
+ return obj;
+ }
+
+ public void BaseDataOnDemand.setName(Base obj, int index) {
+ String name = "name_" + index;
+ obj.setName(name);
+ }
+
+ public Base BaseDataOnDemand.getSpecificBase(int index) {
+ init();
+ if (index < 0) {
+ index = 0;
+ }
+ if (index > (data.size() - 1)) {
+ index = data.size() - 1;
+ }
+ Base obj = data.get(index);
+ Long id = obj.getId();
+ return Base.findBase(id);
+ }
+
+ public Base BaseDataOnDemand.getRandomBase() {
+ init();
+ Base obj = data.get(rnd.nextInt(data.size()));
+ Long id = obj.getId();
+ return Base.findBase(id);
+ }
+
+ public boolean BaseDataOnDemand.modifyBase(Base obj) {
+ return false;
+ }
+
+ public void BaseDataOnDemand.init() {
+ int from = 0;
+ int to = 10;
+ data = Base.findBaseEntries(from, to);
+ if (data == null) {
+ throw new IllegalStateException("Find entries implementation for 'Base' illegally returned null");
+ }
+ if (!data.isEmpty()) {
+ return;
+ }
+
+ data = new ArrayList<Base>();
+ for (int i = 0; i < 10; i++) {
+ Base obj = getNewTransientBase(i);
+ try {
+ obj.persist();
+ } catch (ConstraintViolationException e) {
+ StringBuilder msg = new StringBuilder();
+ for (Iterator<ConstraintViolation<?>> iter = e.getConstraintViolations().iterator(); iter.hasNext();) {
+ ConstraintViolation<?> cv = iter.next();
+ msg.append("[").append(cv.getConstraintDescriptor()).append(":").append(cv.getMessage()).append("=").append(cv.getInvalidValue()).append("]");
+ }
+ throw new RuntimeException(msg.toString(), e);
+ }
+ obj.flush();
+ data.add(obj);
+ }
+ }
+
+}
View
13 ...hop-activerecord/src/test/java/com/springsource/pizzashop/domain/BaseIntegrationTest_Roo_Configurable.aj
@@ -0,0 +1,13 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.BaseIntegrationTest;
+import org.springframework.beans.factory.annotation.Configurable;
+
+privileged aspect BaseIntegrationTest_Roo_Configurable {
+
+ declare @type: BaseIntegrationTest: @Configurable;
+
+}
View
121 ...-activerecord/src/test/java/com/springsource/pizzashop/domain/BaseIntegrationTest_Roo_IntegrationTest.aj
@@ -0,0 +1,121 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.Base;
+import com.springsource.pizzashop.domain.BaseDataOnDemand;
+import com.springsource.pizzashop.domain.BaseIntegrationTest;
+import java.util.List;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.transaction.annotation.Transactional;
+
+privileged aspect BaseIntegrationTest_Roo_IntegrationTest {
+
+ declare @type: BaseIntegrationTest: @RunWith(SpringJUnit4ClassRunner.class);
+
+ declare @type: BaseIntegrationTest: @ContextConfiguration(locations = "classpath:/META-INF/spring/applicationContext*.xml");
+
+ declare @type: BaseIntegrationTest: @Transactional;
+
+ @Autowired
+ private BaseDataOnDemand BaseIntegrationTest.dod;
+
+ @Test
+ public void BaseIntegrationTest.testCountBases() {
+ Assert.assertNotNull("Data on demand for 'Base' failed to initialize correctly", dod.getRandomBase());
+ long count = Base.countBases();
+ Assert.assertTrue("Counter for 'Base' incorrectly reported there were no entries", count > 0);
+ }
+
+ @Test
+ public void BaseIntegrationTest.testFindBase() {
+ Base obj = dod.getRandomBase();
+ Assert.assertNotNull("Data on demand for 'Base' failed to initialize correctly", obj);
+ Long id = obj.getId();
+ Assert.assertNotNull("Data on demand for 'Base' failed to provide an identifier", id);
+ obj = Base.findBase(id);
+ Assert.assertNotNull("Find method for 'Base' illegally returned null for id '" + id + "'", obj);
+ Assert.assertEquals("Find method for 'Base' returned the incorrect identifier", id, obj.getId());
+ }
+
+ @Test
+ public void BaseIntegrationTest.testFindAllBases() {
+ Assert.assertNotNull("Data on demand for 'Base' failed to initialize correctly", dod.getRandomBase());
+ long count = Base.countBases();
+ Assert.assertTrue("Too expensive to perform a find all test for 'Base', as there are " + count + " entries; set the findAllMaximum to exceed this value or set findAll=false on the integration test annotation to disable the test", count < 250);
+ List<Base> result = Base.findAllBases();
+ Assert.assertNotNull("Find all method for 'Base' illegally returned null", result);
+ Assert.assertTrue("Find all method for 'Base' failed to return any data", result.size() > 0);
+ }
+
+ @Test
+ public void BaseIntegrationTest.testFindBaseEntries() {
+ Assert.assertNotNull("Data on demand for 'Base' failed to initialize correctly", dod.getRandomBase());
+ long count = Base.countBases();
+ if (count > 20) count = 20;
+ int firstResult = 0;
+ int maxResults = (int) count;
+ List<Base> result = Base.findBaseEntries(firstResult, maxResults);
+ Assert.assertNotNull("Find entries method for 'Base' illegally returned null", result);
+ Assert.assertEquals("Find entries method for 'Base' returned an incorrect number of entries", count, result.size());
+ }
+
+ @Test
+ public void BaseIntegrationTest.testFlush() {
+ Base obj = dod.getRandomBase();
+ Assert.assertNotNull("Data on demand for 'Base' failed to initialize correctly", obj);
+ Long id = obj.getId();
+ Assert.assertNotNull("Data on demand for 'Base' failed to provide an identifier", id);
+ obj = Base.findBase(id);
+ Assert.assertNotNull("Find method for 'Base' illegally returned null for id '" + id + "'", obj);
+ boolean modified = dod.modifyBase(obj);
+ Integer currentVersion = obj.getVersion();
+ obj.flush();
+ Assert.assertTrue("Version for 'Base' failed to increment on flush directive", (currentVersion != null && obj.getVersion() > currentVersion) || !modified);
+ }
+
+ @Test
+ public void BaseIntegrationTest.testMergeUpdate() {
+ Base obj = dod.getRandomBase();
+ Assert.assertNotNull("Data on demand for 'Base' failed to initialize correctly", obj);
+ Long id = obj.getId();
+ Assert.assertNotNull("Data on demand for 'Base' failed to provide an identifier", id);
+ obj = Base.findBase(id);
+ boolean modified = dod.modifyBase(obj);
+ Integer currentVersion = obj.getVersion();
+ Base merged = obj.merge();
+ obj.flush();
+ Assert.assertEquals("Identifier of merged object not the same as identifier of original object", merged.getId(), id);
+ Assert.assertTrue("Version for 'Base' failed to increment on merge and flush directive", (currentVersion != null && obj.getVersion() > currentVersion) || !modified);
+ }
+
+ @Test
+ public void BaseIntegrationTest.testPersist() {
+ Assert.assertNotNull("Data on demand for 'Base' failed to initialize correctly", dod.getRandomBase());
+ Base obj = dod.getNewTransientBase(Integer.MAX_VALUE);
+ Assert.assertNotNull("Data on demand for 'Base' failed to provide a new transient entity", obj);
+ Assert.assertNull("Expected 'Base' identifier to be null", obj.getId());
+ obj.persist();
+ obj.flush();
+ Assert.assertNotNull("Expected 'Base' identifier to no longer be null", obj.getId());
+ }
+
+ @Test
+ public void BaseIntegrationTest.testRemove() {
+ Base obj = dod.getRandomBase();
+ Assert.assertNotNull("Data on demand for 'Base' failed to initialize correctly", obj);
+ Long id = obj.getId();
+ Assert.assertNotNull("Data on demand for 'Base' failed to provide an identifier", id);
+ obj = Base.findBase(id);
+ obj.remove();
+ obj.flush();
+ Assert.assertNull("Failed to remove 'Base' with identifier '" + id + "'", Base.findBase(id));
+ }
+
+}
View
13 ...ashop-activerecord/src/test/java/com/springsource/pizzashop/domain/PizzaDataOnDemand_Roo_Configurable.aj
@@ -0,0 +1,13 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.PizzaDataOnDemand;
+import org.springframework.beans.factory.annotation.Configurable;
+
+privileged aspect PizzaDataOnDemand_Roo_Configurable {
+
+ declare @type: PizzaDataOnDemand: @Configurable;
+
+}
View
101 ...ashop-activerecord/src/test/java/com/springsource/pizzashop/domain/PizzaDataOnDemand_Roo_DataOnDemand.aj
@@ -0,0 +1,101 @@
+// 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.domain;
+
+import com.springsource.pizzashop.domain.BaseDataOnDemand;
+import com.springsource.pizzashop.domain.Pizza;
+import com.springsource.pizzashop.domain.PizzaDataOnDemand;
+import java.math.BigDecimal;
+import java.security.SecureRandom;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+privileged aspect PizzaDataOnDemand_Roo_DataOnDemand {
+
+ declare @type: PizzaDataOnDemand: @Component;
+
+ private Random PizzaDataOnDemand.rnd = new SecureRandom();