Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prov 103 [issue](https://issues.openmrs.org/browse/PROV-103) #45

Merged
merged 32 commits into from
Nov 8, 2023
Merged
Changes from 20 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3085d83
PROV-103: added a conditional resource to load the NameSupport class …
josephbate Nov 3, 2022
ca18092
more changesin the ProviderManagementActivator to test whether the o…
josephbate Nov 15, 2022
76e8d3a
using java reflection to load the class
josephbate Nov 18, 2022
ed24628
[maven-release-plugin] prepare release 2.14.0
openmrs-bot Nov 21, 2022
a0b912a
[maven-release-plugin] prepare for next development iteration
openmrs-bot Nov 21, 2022
151358d
my third commit
josephbate Jan 30, 2023
28113a3
my final commit
josephbate Feb 1, 2023
ae537e7
cleaning up and doing backward compatibility
josephbate Feb 9, 2023
3e3b91a
final clean up and backward compatibility
josephbate Feb 10, 2023
0155b32
cleaning up
josephbate Feb 15, 2023
3009579
cleaning up 2
josephbate Feb 15, 2023
e0182c3
rremoving ReflectString.java
josephbate Feb 15, 2023
d56f6eb
cleaning up
josephbate Feb 15, 2023
15cb82f
cleaning
josephbate Feb 15, 2023
0a4101b
reformatting the code
josephbate Feb 15, 2023
721c688
clean
josephbate Feb 16, 2023
209a1ae
clean up
josephbate Feb 16, 2023
cd585a3
clean
josephbate Feb 16, 2023
492870f
clean
josephbate Feb 16, 2023
2e216f5
cleaning
josephbate Feb 16, 2023
2d9e86e
formatting PersonName.java
josephbate Feb 21, 2023
79d7459
final commit
josephbate Feb 21, 2023
d4e05db
edited commit
josephbate Oct 15, 2023
88dae7a
Merge remote-tracking branch 'origin/PROV-103' into PROV-103
josephbate Oct 15, 2023
ddef0be
cleaning up the code
josephbate Oct 15, 2023
4e20d3a
improving on java docs
josephbate Oct 18, 2023
b5e83a5
editing java docs give more info
josephbate Nov 2, 2023
14d33cc
Correcting version
josephbate Nov 2, 2023
645eebe
to solves errors
josephbate Nov 2, 2023
c2d83c9
clean version
josephbate Nov 2, 2023
fb0b080
version for omod pom.xml
josephbate Nov 2, 2023
746194f
cleaning
josephbate Nov 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,46 @@

package org.openmrs.module.providermanagement.fragment.controller;

import org.openmrs.layout.web.name.NameSupport;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;

import org.openmrs.ui.framework.fragment.FragmentModel;

public class PersonNameFragmentController {

public void controller(FragmentModel model) {
model.addAttribute("layoutTemplate", NameSupport.getInstance().getDefaultLayoutTemplate());
}


/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to include Javadocs, they should actually provide some information.

* @param model
* @throws ClassNotFoundException
* @throws SecurityException
* @throws NoSuchMethodException
* @throws InvocationTargetException
* @throws IllegalArgumentException
* @throws IllegalAccessException
*/

public void controller(FragmentModel model) throws ClassNotFoundException, NoSuchMethodException, SecurityException,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think at this point, its just easier to say throws Exception, no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, is there nothing we can do here to recover from these exceptions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have any suggestions @ibacher

IllegalAccessException, IllegalArgumentException, InvocationTargetException {

/*
* backward compatibility
*/
Class<?> nameSurpport;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Class<?> nameSurpport;
Class<?> nameSupport;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello @ibacher thank you for pointing them out let me try to solve them


try {
nameSurpport = Class.forName("org.openmrs.layout.name.NameSupport");
}
catch (ClassNotFoundException e) {
nameSurpport = Class.forName("org.openmrs.layout.web.name.NameSupport");
}

Method getInstance = nameSurpport.getDeclaredMethod("getInstance");
Object instance = getInstance.invoke(null);

Method getLayoutTemplate = nameSurpport.getMethod("getDefaultLayoutTemplate");
Object layoutTemplate = getLayoutTemplate.invoke(instance);

model.addAttribute("layoutTemplate", layoutTemplate);

}

}