Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…45)"

This reverts commit 8ee4396.
  • Loading branch information
dkayiwa authored Nov 8, 2023
1 parent 8ee4396 commit 452f7ab
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 40 deletions.
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.openmrs.module</groupId>
<artifactId>providermanagement</artifactId>
<version>2.14.0-SNAPSHOT</version>
<version>2.15.0-SNAPSHOT</version>
</parent>

<artifactId>providermanagement-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion omod/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.openmrs.module</groupId>
<artifactId>providermanagement</artifactId>
<version>2.14.0-SNAPSHOT</version>
<version>2.15.0-SNAPSHOT</version>
</parent>

<artifactId>providermanagement-omod</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.openmrs.module</groupId>
<artifactId>providermanagement</artifactId>
<version>2.14.0-SNAPSHOT</version>
<version>2.15.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Provider Management Module</name>
<description>Allows for the creation of provider roles, as well as the management of provider/provider and provider/patient relationships.</description>
Expand Down

0 comments on commit 452f7ab

Please sign in to comment.