use of org.kuali.kfs.kim.service.impl.KimModuleService in project cu-kfs by CU-CommunityApps.
the class KualiInquiryAction method start.
/**
* Gets an inquirable impl from the impl service name parameter. Then calls lookup service to retrieve the record
* from the key/value parameters. Finally gets a list of Rows from the inquirable
*/
// CU Customization: Allow the KIM module to return custom Person and Role inquiry URL redirects.
public ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
InquiryForm inquiryForm = (InquiryForm) form;
if (inquiryForm.getBusinessObjectClassName() == null) {
LOG.error("Business object name not given.");
throw new RuntimeException("Business object name not given.");
}
Class boClass = Class.forName(inquiryForm.getBusinessObjectClassName());
ModuleService responsibleModuleService = KRADServiceLocatorWeb.getKualiModuleService().getResponsibleModuleService(boClass);
if (responsibleModuleService != null && responsibleModuleService.isExternalizable(boClass)) {
String redirectUrl = responsibleModuleService.getExternalizableBusinessObjectInquiryUrl(boClass, request.getParameterMap());
ActionForward redirectingActionForward = new RedirectingActionForward(redirectUrl);
redirectingActionForward.setModule("/");
return redirectingActionForward;
} else if (responsibleModuleService instanceof KimModuleService) {
KimModuleService kimModuleService = (KimModuleService) responsibleModuleService;
if (kimModuleService.hasCustomInquiryUrl(boClass)) {
String baseInquiryUrl = kimModuleService.getInquiryUrl(boClass);
Map<String, String> urlParameters = kimModuleService.getUrlParameters(boClass.getName(), request.getParameterMap());
String redirectUrl = UrlFactory.parameterizeUrl(baseInquiryUrl, urlParameters);
ActionForward redirectingActionForward = new RedirectingActionForward(redirectUrl);
redirectingActionForward.setModule("/");
return redirectingActionForward;
}
}
return continueWithInquiry(mapping, form, request, response);
}
Aggregations