001package org.kuali.ole.select.controller;
002
003import org.kuali.ole.OLEConstants;
004import org.kuali.ole.select.bo.OLEPOClaimHistory;
005import org.kuali.ole.select.businessobject.OlePurchaseOrderItem;
006import org.kuali.ole.select.document.OlePurchaseOrderDocument;
007import org.kuali.ole.select.form.OLEClaimingSearchForm;
008import org.kuali.ole.select.service.OLEClaimingSearchService;
009import org.kuali.rice.krad.service.KRADServiceLocator;
010import org.kuali.rice.krad.util.GlobalVariables;
011import org.kuali.rice.krad.web.controller.UifControllerBase;
012import org.kuali.rice.krad.web.form.UifFormBase;
013import org.springframework.stereotype.Controller;
014import org.springframework.validation.BindingResult;
015import org.springframework.web.bind.annotation.ModelAttribute;
016import org.springframework.web.bind.annotation.RequestMapping;
017import org.springframework.web.servlet.ModelAndView;
018
019import javax.servlet.http.HttpServletRequest;
020import javax.servlet.http.HttpServletResponse;
021import java.util.ArrayList;
022import java.util.List;
023
024/**
025 * Created with IntelliJ IDEA.
026 * User: vivekb
027 * Date: 1/22/14
028 * Time: 3:01 PM
029 * To change this template use File | Settings | File Templates.
030 */
031@Controller
032@RequestMapping(value = "/oleClaimingSearchController")
033public class OLEClaimingSearchController extends UifControllerBase {
034    @Override
035    protected UifFormBase createInitialForm(HttpServletRequest request) {
036        return new OLEClaimingSearchForm();
037    }
038
039    @RequestMapping(params = "methodToCall=search")
040    public ModelAndView search(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
041                               HttpServletRequest request, HttpServletResponse response) {
042        OLEClaimingSearchForm oleClaimingSearchForm = (OLEClaimingSearchForm) form;
043        OLEClaimingSearchService oleClaimingSearchService=new OLEClaimingSearchService();
044        oleClaimingSearchForm.setClaimErrorMessage("");
045        oleClaimingSearchService.getClaimResponse(oleClaimingSearchForm);
046        return getUIFModelAndView(oleClaimingSearchForm);
047    }
048
049    @RequestMapping(params = "methodToCall=clearSearch")
050    public ModelAndView clearSearch(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
051                               HttpServletRequest request, HttpServletResponse response) {
052        OLEClaimingSearchForm oleClaimingSearchForm = (OLEClaimingSearchForm) form;
053        oleClaimingSearchForm.setVendorName("");
054        oleClaimingSearchForm.setTitle("");
055        oleClaimingSearchForm.setClaimDate(null);
056        oleClaimingSearchForm.setSuccessMsg("");
057        oleClaimingSearchForm.setClaimErrorMessage("");
058        oleClaimingSearchForm.setOleClaimingSearchRecordList(new ArrayList<OLEPOClaimHistory>());
059        return getUIFModelAndView(oleClaimingSearchForm);
060    }
061
062    @RequestMapping(params = "methodToCall=updateClaimNote")
063    public ModelAndView updateClaimNote(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
064                               HttpServletRequest request, HttpServletResponse response) {
065        OLEClaimingSearchForm oleClaimingSearchForm = (OLEClaimingSearchForm) form;
066        OLEClaimingSearchService oleClaimingSearchService=new OLEClaimingSearchService();
067        oleClaimingSearchService.updateClaimNote(oleClaimingSearchForm);
068        return getUIFModelAndView(oleClaimingSearchForm);
069    }
070}