Search in sources :

Example 1 with InquiryForm

use of org.kuali.kfs.kns.web.struts.form.InquiryForm in project cu-kfs by CU-CommunityApps.

the class KualiInquiryAction method showAllTabs.

@Override
public ActionForward showAllTabs(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    // KULRICE-2852: Overrides showAllTabs() so that it also calls the populateSections() method.
    InquiryForm inquiryForm = (InquiryForm) form;
    if (inquiryForm.getBusinessObjectClassName() == null) {
        LOG.error("Business object name not given.");
        throw new RuntimeException("Business object name not given.");
    }
    BusinessObject bo = retrieveBOFromInquirable(inquiryForm);
    checkBO(bo);
    populateSections(mapping, request, inquiryForm, bo);
    return super.showAllTabs(mapping, form, request, response);
}
Also used : BusinessObject(org.kuali.kfs.krad.bo.BusinessObject) InquiryForm(org.kuali.kfs.kns.web.struts.form.InquiryForm)

Example 2 with InquiryForm

use of org.kuali.kfs.kns.web.struts.form.InquiryForm in project cu-kfs by CU-CommunityApps.

the class KualiInquiryAction method toggleTab.

@Override
public ActionForward toggleTab(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.");
    }
    BusinessObject bo = retrieveBOFromInquirable(inquiryForm);
    checkBO(bo);
    populateSections(mapping, request, inquiryForm, bo);
    return super.toggleTab(mapping, form, request, response);
}
Also used : BusinessObject(org.kuali.kfs.krad.bo.BusinessObject) InquiryForm(org.kuali.kfs.kns.web.struts.form.InquiryForm)

Example 3 with InquiryForm

use of org.kuali.kfs.kns.web.struts.form.InquiryForm in project cu-kfs by CU-CommunityApps.

the class KualiInquiryAction method continueWithInquiry.

public ActionForward continueWithInquiry(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.");
    }
    BusinessObject bo = retrieveBOFromInquirable(inquiryForm);
    checkBO(bo);
    populateSections(mapping, request, inquiryForm, bo);
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : BusinessObject(org.kuali.kfs.krad.bo.BusinessObject) InquiryForm(org.kuali.kfs.kns.web.struts.form.InquiryForm)

Example 4 with InquiryForm

use of org.kuali.kfs.kns.web.struts.form.InquiryForm in project cu-kfs by CU-CommunityApps.

the class KualiInquiryAction method downloadCustomBOAttachment.

public ActionForward downloadCustomBOAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    String fileName = request.getParameter(KRADConstants.BO_ATTACHMENT_FILE_NAME);
    String contentType = request.getParameter(KRADConstants.BO_ATTACHMENT_FILE_CONTENT_TYPE);
    String fileContentBoField = request.getParameter(KRADConstants.BO_ATTACHMENT_FILE_CONTENT_FIELD);
    // require certain request properties
    if (fileName != null && contentType != null && fileContentBoField != null) {
        // make sure user has authorization to download attachment
        checkAuthorization(form, findMethodToCall(form, request));
        fileName = StringUtils.replace(fileName, " ", "_");
        InquiryForm inquiryForm = (InquiryForm) form;
        BusinessObject bo = retrieveBOFromInquirable(inquiryForm);
        checkBO(bo);
        Class clazz = bo.getClass();
        Method method = clazz.getMethod("get" + StringUtils.capitalize(fileContentBoField));
        byte[] fileContents = (byte[]) method.invoke(bo);
        streamToResponse(fileContents, fileName, contentType, response);
    } else {
        if (fileName == null) {
            LOG.error("Request Parameter \"" + KRADConstants.BO_ATTACHMENT_FILE_NAME + "\" not provided.");
        }
        if (contentType == null) {
            LOG.error("Request Parameter \"" + KRADConstants.BO_ATTACHMENT_FILE_CONTENT_TYPE + "\" not provided.");
        }
        if (fileContentBoField == null) {
            LOG.error("Request Parameter \"" + KRADConstants.BO_ATTACHMENT_FILE_CONTENT_FIELD + "\" not provided.");
        }
    }
    return null;
}
Also used : Method(java.lang.reflect.Method) BusinessObject(org.kuali.kfs.krad.bo.BusinessObject) InquiryForm(org.kuali.kfs.kns.web.struts.form.InquiryForm)

Example 5 with InquiryForm

use of org.kuali.kfs.kns.web.struts.form.InquiryForm in project cu-kfs by CU-CommunityApps.

the class KualiInquiryAction method hideAllTabs.

@Override
public ActionForward hideAllTabs(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    // KULRICE-2852: Overrides hideAllTabs() so that it also calls the populateSections() method.
    InquiryForm inquiryForm = (InquiryForm) form;
    if (inquiryForm.getBusinessObjectClassName() == null) {
        LOG.error("Business object name not given.");
        throw new RuntimeException("Business object name not given.");
    }
    BusinessObject bo = retrieveBOFromInquirable(inquiryForm);
    checkBO(bo);
    populateSections(mapping, request, inquiryForm, bo);
    return super.hideAllTabs(mapping, form, request, response);
}
Also used : BusinessObject(org.kuali.kfs.krad.bo.BusinessObject) InquiryForm(org.kuali.kfs.kns.web.struts.form.InquiryForm)

Aggregations

InquiryForm (org.kuali.kfs.kns.web.struts.form.InquiryForm)9 BusinessObject (org.kuali.kfs.krad.bo.BusinessObject)8 Method (java.lang.reflect.Method)1 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 BusinessObjectEntry (org.kuali.kfs.kns.datadictionary.BusinessObjectEntry)1 Inquirable (org.kuali.kfs.kns.inquiry.Inquirable)1 Exporter (org.kuali.kfs.krad.bo.Exporter)1 PersistableAttachment (org.kuali.kfs.krad.bo.PersistableAttachment)1 PersistableAttachmentList (org.kuali.kfs.krad.bo.PersistableAttachmentList)1 ModuleService (org.kuali.kfs.krad.service.ModuleService)1