From 0aefe99d9a173e674313d22db14eef43b67b2c65 Mon Sep 17 00:00:00 2001 From: jnsereko Date: Tue, 10 Sep 2024 16:06:23 +0300 Subject: [PATCH 1/2] (fix) Fix no adapter error when saving a form resource --- .../v1_0/controller/openmrs1_9/FormResourceController1_9.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_9/FormResourceController1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_9/FormResourceController1_9.java index ea45b99cc..01c21e3f7 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_9/FormResourceController1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_9/FormResourceController1_9.java @@ -36,7 +36,7 @@ public class FormResourceController1_9 extends MainResourceController { @Autowired private FormService formService; - @RequestMapping(value = "/rest/" + RestConstants.VERSION_1 + "/form/{uuid}/resource/{resourceUuid}/value", method = RequestMethod.POST, headers = { "Content-Type=multipart/form-data" }) + @RequestMapping(method = RequestMethod.POST, headers = { "Content-Type=multipart/form-data" }) @ResponseBody public Object createResourceValue(@PathVariable("uuid") String formUuid, @PathVariable("resourceUuid") String resourceUuid, @RequestParam("value") MultipartFile file, @@ -56,7 +56,7 @@ public Object createResourceValue(@PathVariable("uuid") String formUuid, return new FormResourceResource1_9().asDefaultRep(resource); } - @RequestMapping(value = "/rest/" + RestConstants.VERSION_1 + "/form/{uuid}/resource/{resourceUuid}/value", method = RequestMethod.GET) + @RequestMapping(method = RequestMethod.GET) public void getResourceValue(@PathVariable("uuid") String formUuid, @PathVariable("resourceUuid") String resourceUuid, HttpServletRequest request, HttpServletResponse response) throws Exception { //Get the resource From fc3e0cfa66a868b8795da4deaeee4c72e059d0e6 Mon Sep 17 00:00:00 2001 From: jnsereko Date: Wed, 11 Sep 2024 11:20:59 +0300 Subject: [PATCH 2/2] add url to methods --- .../controller/openmrs1_9/FormResourceController1_9.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_9/FormResourceController1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_9/FormResourceController1_9.java index 01c21e3f7..e4006992a 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_9/FormResourceController1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_9/FormResourceController1_9.java @@ -27,7 +27,7 @@ import javax.servlet.http.HttpServletResponse; @Controller("webservices.rest.formResourceController") -@RequestMapping(value = "/rest/" + RestConstants.VERSION_1 + "/form/{uuid}/resource/{resourceUuid}/value") +@RequestMapping(value = "/rest/" + RestConstants.VERSION_1 + "/form") public class FormResourceController1_9 extends MainResourceController { @Autowired @@ -36,7 +36,7 @@ public class FormResourceController1_9 extends MainResourceController { @Autowired private FormService formService; - @RequestMapping(method = RequestMethod.POST, headers = { "Content-Type=multipart/form-data" }) + @RequestMapping(value = "/{uuid}/resource/{resourceUuid}/value", method = RequestMethod.POST, headers = { "Content-Type=multipart/form-data" }) @ResponseBody public Object createResourceValue(@PathVariable("uuid") String formUuid, @PathVariable("resourceUuid") String resourceUuid, @RequestParam("value") MultipartFile file, @@ -56,7 +56,7 @@ public Object createResourceValue(@PathVariable("uuid") String formUuid, return new FormResourceResource1_9().asDefaultRep(resource); } - @RequestMapping(method = RequestMethod.GET) + @RequestMapping(value = "/{uuid}/resource/{resourceUuid}/value", method = RequestMethod.GET) public void getResourceValue(@PathVariable("uuid") String formUuid, @PathVariable("resourceUuid") String resourceUuid, HttpServletRequest request, HttpServletResponse response) throws Exception { //Get the resource