Hello to everyone. I am not very experience in Spring or OpenMRS development, so please bear with me.
I am working on a module that does some flexible/approximate search on the OpenMRS database.
My first issue is that the module I currently have works when I have the Legacy UI Installed. But it does not work without it.
I built the Legacy UI from github on 12/12/2014, and am currently using the platform 2.0.0 war on tomcat.
I built the module using the maven archetype, and the changes I have made are the following
The resultSet is a POJO which is currently set to hardcoded values for testing.
The following code works in when the UI is installed and the module is hit from: openmrs/module/flexiblesearch/search.form
directory structure: omod\src\main\java\org\openmrs\module\flexiblesearch\controller Controller Class
public class FlexibleSearchManageController {
protected final Log log = LogFactory.getLog(getClass());
@RequestMapping(value = "/module/flexiblesearch/search", method = RequestMethod.GET)
public void showForm(){
//since this method has not been implemented
// Spring MVC will look for the last part in the above mapping
// in the webapp folder appended with a jsp
// in this case it would look for search.jsp
// also need to create a link in the admin list
}
@ModelAttribute
public ResultSet getSearchResults(@RequestParam(required=false, value="searchQuery") ResultSet resultSet){
resultSet = new ResultSet();
return resultSet;
}
}
dir: \omod\src\main\webapp JSP Page: …includes for footer and header are in the jsp
Enter Your Search Query:First Name | ${resultSet.firstName} |
---|---|
Last Name | ${resultSet.lastName} |
Telephone | ${resultSet.telephone} |
Address | ${resultSet.address} |
Patient ID | ${resultSet.patientID} |
AdminList.java public Map<String, String> getLinks() { LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(); map.put("/module/flexiblesearch/search", “Flexible Search”); return map; }
Quick Note: Can the admin list extension point cause this dependency?
I have not modified the config.xml file yet. Do I need to add a servlet name/class mapping in there? I am working under the assumption that the request mapping from spring takes care of that.
The reason I cannot test is something that arose just recently. My teammate installed platform 2.0.0 and then installed the legacy UI on top of that and it ran without problem. I deleted my OpenMRS installation completed (deleted from tomcat webapp folder as well as the app data directory) and reinstalled and added the legacy UI module I ran into this problem:
ERROR - ModuleFactory.startModules(228) |2016-12-13 04:53:30,907| Could not start some modules because they depend on others which are not started. Please first start them or use the “Start All” button on the “Manage Modules” page: [owa->legacyui, fhir->legacyui, webservices.rest->legacyui] org.openmrs.util.CycleException: [owa->legacyui, fhir->legacyui, webservices.rest->legacyui] at org.openmrs.util.Graph.topologicalSort(Graph.java:170) at org.openmrs.module.ModuleFactory.getModulesInStartupOrder(ModuleFactory.java:336) at org.openmrs.module.ModuleFactory.startModules(ModuleFactory.java:224) at org.openmrs.module.ModuleUtil.startup(ModuleUtil.java:128) at org.openmrs.api.context.Context.startup(Context.java:830) at org.openmrs.web.Listener.startOpenmrs(Listener.java:245) at org.openmrs.web.WebDaemon$1.run(WebDaemon.java:42)
My second question is, how can I use the service layer to directly access the openmrs database?
I appreciate any help you can give me. Thank You.
I hope someone can help with some, if not all of the problems. I would be very grateful.
Thanks,