Search in sources :

Example 1 with KimModuleService

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);
}
Also used : KimModuleService(org.kuali.kfs.kim.service.impl.KimModuleService) ModuleService(org.kuali.kfs.krad.service.ModuleService) RedirectingActionForward(org.apache.struts.action.RedirectingActionForward) KimModuleService(org.kuali.kfs.kim.service.impl.KimModuleService) Map(java.util.Map) InquiryForm(org.kuali.kfs.kns.web.struts.form.InquiryForm) ActionForward(org.apache.struts.action.ActionForward) RedirectingActionForward(org.apache.struts.action.RedirectingActionForward)

Aggregations

Map (java.util.Map)1 ActionForward (org.apache.struts.action.ActionForward)1 RedirectingActionForward (org.apache.struts.action.RedirectingActionForward)1 KimModuleService (org.kuali.kfs.kim.service.impl.KimModuleService)1 InquiryForm (org.kuali.kfs.kns.web.struts.form.InquiryForm)1 ModuleService (org.kuali.kfs.krad.service.ModuleService)1