AbstractEatController.java 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. /* ===================================================================
  2. * AbstractEatCommandController.java
  3. *
  4. * Created Sep 19, 2004 4:52:17 PM
  5. *
  6. * Copyright (c) 2004 Matt Magoffin (spamsqr@msqr.us)
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  21. * 02111-1307 USA
  22. * ===================================================================
  23. * $Id: AbstractEatController.java 28 2009-05-04 01:19:45Z msqr $
  24. * ===================================================================
  25. */
  26. package magoffin.matt.ieat.web;
  27. import magoffin.matt.ieat.biz.DomainObjectFactory;
  28. import magoffin.matt.ieat.biz.RecipeBiz;
  29. import magoffin.matt.ieat.biz.RecipeSearchBiz;
  30. import magoffin.matt.ieat.biz.RecipeSearchIndexBiz;
  31. import magoffin.matt.ieat.biz.UserBiz;
  32. import magoffin.matt.xweb.util.MessagesSource;
  33. import org.springframework.web.servlet.mvc.AbstractController;
  34. /**
  35. * Abstract base class for command controllers.
  36. *
  37. * @author Matt Magoffin (spamsqr@msqr.us)
  38. * @version $Revision: 28 $ $Date: 2009-05-04 13:19:45 +1200 (Mon, 04 May 2009) $
  39. */
  40. public abstract class AbstractEatController extends AbstractController {
  41. /** The RecipeBiz. */
  42. protected RecipeBiz recipeBiz = null;
  43. /** The RecipeSearchBiz. */
  44. protected RecipeSearchBiz recipeSearchBiz = null;
  45. /** The UserBiz. */
  46. protected UserBiz userBiz = null;
  47. /** The RecipeSearchIndexBiz. */
  48. protected RecipeSearchIndexBiz searchIndexBiz = null;
  49. private String messagesSourceBeanName = "messageSource";
  50. private String recipeBizBeanName = "recipeBiz";
  51. private String userBizBeanName = "userBiz";
  52. private String recipeSearchBizBeanName = "recipeSearchBiz";
  53. private String searchIndexBizBeanName = "recipeSearchIndexBiz";
  54. private String domainObjectFactoryBeanName = "domainObjectFactory";
  55. private String successView = null;
  56. private DomainObjectFactory domainObjectFactory = null;
  57. private MessagesSource messagesSource = null;
  58. /**
  59. * Default constructor.
  60. */
  61. public AbstractEatController() {
  62. super();
  63. }
  64. @Override
  65. protected void initApplicationContext() {
  66. super.initApplicationContext();
  67. if (recipeBiz == null) {
  68. recipeBiz = (RecipeBiz)getApplicationContext()
  69. .getBean(recipeBizBeanName);
  70. }
  71. if (recipeSearchBiz == null) {
  72. recipeSearchBiz = (RecipeSearchBiz)getApplicationContext()
  73. .getBean(recipeSearchBizBeanName);
  74. }
  75. if (searchIndexBiz == null) {
  76. searchIndexBiz = (RecipeSearchIndexBiz)getApplicationContext()
  77. .getBean(searchIndexBizBeanName);
  78. }
  79. if (userBiz == null) {
  80. userBiz = (UserBiz)getApplicationContext()
  81. .getBean(userBizBeanName);
  82. }
  83. if ( messagesSource == null ) {
  84. messagesSource = (MessagesSource)getApplicationContext()
  85. .getBean(messagesSourceBeanName);
  86. }
  87. if ( domainObjectFactory == null ) {
  88. domainObjectFactory = (DomainObjectFactory)getApplicationContext()
  89. .getBean(domainObjectFactoryBeanName);
  90. }
  91. }
  92. /**
  93. * @return the recipeBiz
  94. */
  95. public RecipeBiz getRecipeBiz() {
  96. return recipeBiz;
  97. }
  98. /**
  99. * @param recipeBiz the recipeBiz to set
  100. */
  101. public void setRecipeBiz(RecipeBiz recipeBiz) {
  102. this.recipeBiz = recipeBiz;
  103. }
  104. /**
  105. * @return the recipeSearchBiz
  106. */
  107. public RecipeSearchBiz getRecipeSearchBiz() {
  108. return recipeSearchBiz;
  109. }
  110. /**
  111. * @param recipeSearchBiz the recipeSearchBiz to set
  112. */
  113. public void setRecipeSearchBiz(RecipeSearchBiz recipeSearchBiz) {
  114. this.recipeSearchBiz = recipeSearchBiz;
  115. }
  116. /**
  117. * @return the userBiz
  118. */
  119. public UserBiz getUserBiz() {
  120. return userBiz;
  121. }
  122. /**
  123. * @param userBiz the userBiz to set
  124. */
  125. public void setUserBiz(UserBiz userBiz) {
  126. this.userBiz = userBiz;
  127. }
  128. /**
  129. * @return the searchIndexBiz
  130. */
  131. public RecipeSearchIndexBiz getSearchIndexBiz() {
  132. return searchIndexBiz;
  133. }
  134. /**
  135. * @param searchIndexBiz the searchIndexBiz to set
  136. */
  137. public void setSearchIndexBiz(RecipeSearchIndexBiz searchIndexBiz) {
  138. this.searchIndexBiz = searchIndexBiz;
  139. }
  140. /**
  141. * @return the messagesSourceBeanName
  142. */
  143. public String getMessagesSourceBeanName() {
  144. return messagesSourceBeanName;
  145. }
  146. /**
  147. * @param messagesSourceBeanName the messagesSourceBeanName to set
  148. */
  149. public void setMessagesSourceBeanName(String messagesSourceBeanName) {
  150. this.messagesSourceBeanName = messagesSourceBeanName;
  151. }
  152. /**
  153. * @return the recipeBizBeanName
  154. */
  155. public String getRecipeBizBeanName() {
  156. return recipeBizBeanName;
  157. }
  158. /**
  159. * @param recipeBizBeanName the recipeBizBeanName to set
  160. */
  161. public void setRecipeBizBeanName(String recipeBizBeanName) {
  162. this.recipeBizBeanName = recipeBizBeanName;
  163. }
  164. /**
  165. * @return the userBizBeanName
  166. */
  167. public String getUserBizBeanName() {
  168. return userBizBeanName;
  169. }
  170. /**
  171. * @param userBizBeanName the userBizBeanName to set
  172. */
  173. public void setUserBizBeanName(String userBizBeanName) {
  174. this.userBizBeanName = userBizBeanName;
  175. }
  176. /**
  177. * @return the recipeSearchBizBeanName
  178. */
  179. public String getRecipeSearchBizBeanName() {
  180. return recipeSearchBizBeanName;
  181. }
  182. /**
  183. * @param recipeSearchBizBeanName the recipeSearchBizBeanName to set
  184. */
  185. public void setRecipeSearchBizBeanName(String recipeSearchBizBeanName) {
  186. this.recipeSearchBizBeanName = recipeSearchBizBeanName;
  187. }
  188. /**
  189. * @return the searchIndexBizBeanName
  190. */
  191. public String getSearchIndexBizBeanName() {
  192. return searchIndexBizBeanName;
  193. }
  194. /**
  195. * @param searchIndexBizBeanName the searchIndexBizBeanName to set
  196. */
  197. public void setSearchIndexBizBeanName(String searchIndexBizBeanName) {
  198. this.searchIndexBizBeanName = searchIndexBizBeanName;
  199. }
  200. /**
  201. * @return the domainObjectFactoryBeanName
  202. */
  203. public String getDomainObjectFactoryBeanName() {
  204. return domainObjectFactoryBeanName;
  205. }
  206. /**
  207. * @param domainObjectFactoryBeanName the domainObjectFactoryBeanName to set
  208. */
  209. public void setDomainObjectFactoryBeanName(String domainObjectFactoryBeanName) {
  210. this.domainObjectFactoryBeanName = domainObjectFactoryBeanName;
  211. }
  212. /**
  213. * @return the successView
  214. */
  215. public String getSuccessView() {
  216. return successView;
  217. }
  218. /**
  219. * @param successView the successView to set
  220. */
  221. public void setSuccessView(String successView) {
  222. this.successView = successView;
  223. }
  224. /**
  225. * @return the domainObjectFactory
  226. */
  227. public DomainObjectFactory getDomainObjectFactory() {
  228. return domainObjectFactory;
  229. }
  230. /**
  231. * @param domainObjectFactory the domainObjectFactory to set
  232. */
  233. public void setDomainObjectFactory(DomainObjectFactory domainObjectFactory) {
  234. this.domainObjectFactory = domainObjectFactory;
  235. }
  236. /**
  237. * @return the messagesSource
  238. */
  239. public MessagesSource getMessagesSource() {
  240. return messagesSource;
  241. }
  242. /**
  243. * @param messagesSource the messagesSource to set
  244. */
  245. public void setMessagesSource(MessagesSource messagesSource) {
  246. this.messagesSource = messagesSource;
  247. }
  248. }