| 19 | | import org.openmrs.module.addresshierarchy.layout.web.LayoutSupport; |
|---|
| 20 | | import org.openmrs.module.addresshierarchy.layout.web.address.AddressSupport; |
|---|
| | 28 | import org.openmrs.api.context.Context; |
|---|
| | 29 | import org.openmrs.layout.web.LayoutSupport; |
|---|
| | 30 | import org.openmrs.layout.web.address.AddressSupport; |
|---|
| | 31 | import org.openmrs.module.addresshierarchy.AddressHierarchyService; |
|---|
| | 32 | import org.openmrs.web.controller.layout.LayoutPortletController; |
|---|
| | 33 | import org.springframework.validation.BindException; |
|---|
| | 34 | import org.springframework.web.servlet.ModelAndView; |
|---|
| | 63 | |
|---|
| | 64 | public ModelAndView handleRequest(HttpServletRequest request, |
|---|
| | 65 | HttpServletResponse response) throws ServletException, IOException { |
|---|
| | 66 | super.handleRequest(request, response); |
|---|
| | 67 | Map<String, Object> model = new HashMap<String, Object>(); |
|---|
| | 68 | String portletPath = "/module/addresshierarchy/portlets/addressLayout"; |
|---|
| | 69 | return new ModelAndView(portletPath, "model", model); |
|---|
| | 70 | } |
|---|
| | 71 | |
|---|
| | 72 | //protected void populateModel(HttpServletRequest request, Map<String, Object> model) { |
|---|
| | 73 | //super.populateModel(request, model); |
|---|
| | 74 | //} |
|---|
| | 75 | |
|---|
| | 76 | /* |
|---|
| | 77 | protected ModelAndView processFormSubmission(HttpServletRequest request, HttpServletResponse response, Object obj, BindException errors) throws Exception { |
|---|
| | 78 | |
|---|
| | 79 | System.out.println("in processFormSubmission"); |
|---|
| | 80 | Integer count = getService().getSizeOfPersonTable(); |
|---|
| | 81 | |
|---|
| | 82 | Integer formCount = Integer.valueOf(request.getParameter("count")); |
|---|
| | 83 | |
|---|
| | 84 | if(count == formCount){ |
|---|
| | 85 | Map<String, Object> model = new HashMap<String, Object>(); |
|---|
| | 86 | String portletPath = "/module/addresshierarchy/portlets/addressLayout"; |
|---|
| | 87 | return new ModelAndView(portletPath, "model", model); |
|---|
| | 88 | } |
|---|
| | 89 | |
|---|
| | 90 | else |
|---|
| | 91 | return onSubmit(request,response,obj,errors); |
|---|
| | 92 | } |
|---|
| | 93 | |
|---|
| | 94 | protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object obj, BindException errors) throws Exception { |
|---|
| | 95 | |
|---|
| | 96 | System.out.println("in onsubmit"); |
|---|
| | 97 | |
|---|
| | 98 | List x = getService().getLastRow(); |
|---|
| | 99 | Object[] y = (Object[]) x.get(x.size()-1); |
|---|
| | 100 | Integer id = Integer.valueOf(y[0].toString()); |
|---|
| | 101 | Integer creator = Integer.valueOf(y[1].toString()); |
|---|
| | 102 | Boolean voided = (Boolean) y[2]; |
|---|
| | 103 | Integer voidedby; |
|---|
| | 104 | if(voided) |
|---|
| | 105 | voidedby = Integer.valueOf(y[3].toString()); |
|---|
| | 106 | else |
|---|
| | 107 | voidedby = null; |
|---|
| | 108 | Map<String, Object> model = new HashMap<String, Object>(); |
|---|
| | 109 | String portletPath = "/module/addresshierarchy/portlets/addressLayout"; |
|---|
| | 110 | return new ModelAndView(portletPath, "model", model); |
|---|
| | 111 | |
|---|
| | 112 | }*/ |
|---|
| | 113 | |
|---|
| | 114 | |
|---|