diff --git a/api/pom.xml b/api/pom.xml
index f10175c..0bd7afb 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -4,7 +4,7 @@
org.openmrs.module
providermanagement
- 2.14.0-SNAPSHOT
+ 2.15.0-SNAPSHOT
providermanagement-api
diff --git a/omod/pom.xml b/omod/pom.xml
index db28546..b9f132d 100644
--- a/omod/pom.xml
+++ b/omod/pom.xml
@@ -4,7 +4,7 @@
org.openmrs.module
providermanagement
- 2.14.0-SNAPSHOT
+ 2.15.0-SNAPSHOT
providermanagement-omod
diff --git a/omod/src/main/java/org/openmrs/module/providermanagement/fragment/controller/PersonNameFragmentController.java b/omod/src/main/java/org/openmrs/module/providermanagement/fragment/controller/PersonNameFragmentController.java
index fb75608..c2a06e5 100644
--- a/omod/src/main/java/org/openmrs/module/providermanagement/fragment/controller/PersonNameFragmentController.java
+++ b/omod/src/main/java/org/openmrs/module/providermanagement/fragment/controller/PersonNameFragmentController.java
@@ -14,47 +14,13 @@
package org.openmrs.module.providermanagement.fragment.controller;
-import java.lang.reflect.Method;
-
+import org.openmrs.layout.web.name.NameSupport;
import org.openmrs.ui.framework.fragment.FragmentModel;
public class PersonNameFragmentController {
- /**
- * Controller method to retrieve the layout template and add it to the model.
- *
- * @param model The fragment model to which the layout template will be added.
- * @throws Exception If there are any issues during reflection or if the layout template retrieval fails.
- */
-
- public void controller(FragmentModel model)throws Exception {
-
- Class> nameSupport;
-
- try {
- // Attempt to load the NameSupport class from org.openmrs.layout.name
- nameSupport = Class.forName("org.openmrs.layout.name.NameSupport");
- } catch (ClassNotFoundException e) {
- // If the NameSupport class is not found in org.openmrs.layout.name, try loading it from org.openmrs.layout.web.name
- nameSupport = Class.forName("org.openmrs.layout.web.name.NameSupport");
- }
-
- if (nameSupport == null) {
- // If the NameSupport class couldn't be loaded, return.
- return;
- }
-
- // Use reflection to invoke the "getInstance" method
- Method getInstance = nameSupport.getDeclaredMethod("getInstance");
- Object instance = getInstance.invoke(null);
-
- // Use reflection to invoke the "getDefaultLayoutTemplate" method
- Method getLayoutTemplate = nameSupport.getMethod("getDefaultLayoutTemplate");
- Object layoutTemplate = getLayoutTemplate.invoke(instance);
-
- // Add the layoutTemplate to the model
- model.addAttribute("layoutTemplate", layoutTemplate);
-
+ public void controller(FragmentModel model) {
+ model.addAttribute("layoutTemplate", NameSupport.getInstance().getDefaultLayoutTemplate());
}
}
diff --git a/pom.xml b/pom.xml
index 8546ac0..b534898 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
org.openmrs.module
providermanagement
- 2.14.0-SNAPSHOT
+ 2.15.0-SNAPSHOT
pom
Provider Management Module
Allows for the creation of provider roles, as well as the management of provider/provider and provider/patient relationships.