-
Notifications
You must be signed in to change notification settings - Fork 35
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
Changes from 20 commits
3085d83
ca18092
76e8d3a
ed24628
a0b912a
151358d
28113a3
ae537e7
3e3b91a
0155b32
3009579
e0182c3
d56f6eb
15cb82f
0a4101b
721c688
209a1ae
cd585a3
492870f
2e216f5
2d9e86e
79d7459
d4e05db
88dae7a
ddef0be
4e20d3a
b5e83a5
14d33cc
645eebe
c2d83c9
fb0b080
746194f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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()); | ||||||
} | ||||||
|
||||||
|
||||||
/** | ||||||
* @param model | ||||||
* @throws ClassNotFoundException | ||||||
* @throws SecurityException | ||||||
* @throws NoSuchMethodException | ||||||
* @throws InvocationTargetException | ||||||
* @throws IllegalArgumentException | ||||||
* @throws IllegalAccessException | ||||||
*/ | ||||||
|
||||||
public void controller(FragmentModel model) throws ClassNotFoundException, NoSuchMethodException, SecurityException, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think at this point, its just easier to say There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||||||
|
||||||
} | ||||||
|
||||||
} |
There was a problem hiding this comment.
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.