/connect-web/src/main/java/org/osforce/connect/web/module/system/SystemWidget.java

http://focus-sns.googlecode.com/ · Java · 53 lines · 36 code · 10 blank · 7 comment · 0 complexity · dffa30261315edba882174230d92eef6 MD5 · raw file

  1. package org.osforce.connect.web.module.system;
  2. import javax.persistence.EntityManager;
  3. import javax.persistence.PersistenceContext;
  4. import org.hibernate.search.jpa.Search;
  5. import org.osforce.connect.Application;
  6. import org.osforce.connect.web.AttributeKeys;
  7. import org.osforce.spring4me.web.stereotype.Widget;
  8. import org.springframework.ui.Model;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RequestMethod;
  11. import org.springframework.web.bind.annotation.ResponseBody;
  12. /**
  13. *
  14. * @author <a href="mailto:haozhonghu@hotmail.com">gavin</a>
  15. * @since 1.1.0
  16. * @create May 18, 2011 - 5:27:35 PM
  17. * <a href="http://www.opensourceforce.org">????</a>
  18. */
  19. @Widget
  20. @RequestMapping("/system")
  21. public class SystemWidget {
  22. private EntityManager entityManager;
  23. public SystemWidget() {
  24. }
  25. @PersistenceContext
  26. public void setEntityManager(EntityManager entityManager) {
  27. this.entityManager = entityManager;
  28. }
  29. @RequestMapping(value="menu-view")
  30. public String doMenuView() {
  31. return "system/menu";
  32. }
  33. @RequestMapping(value="info-view")
  34. public String doInfoView(Model model) {
  35. model.addAttribute(AttributeKeys.APPLICATION_KEY_READABLE, Application.getInstance());
  36. return "system/info";
  37. }
  38. @RequestMapping(value={"/search/index"}, method=RequestMethod.GET)
  39. public @ResponseBody Object doIndexAction() {
  40. Search.getFullTextEntityManager(entityManager).createIndexer().start();
  41. return "success";
  42. }
  43. }