001package org.kuali.ole.select.lookup;
002
003import java.util.ArrayList;
004import java.util.List;
005import java.util.Map;
006
007import org.kuali.ole.OLEConstants;
008import org.kuali.ole.select.document.OLEInvoiceIngestLoadReport;
009import org.kuali.rice.krad.lookup.LookupableImpl;
010import org.kuali.rice.krad.util.GlobalVariables;
011import org.kuali.rice.krad.util.KRADConstants;
012import org.kuali.rice.krad.web.form.LookupForm;
013
014/**
015 * Created with IntelliJ IDEA.
016 * User: arunag
017 * Date: 3/5/14
018 * Time: 11:55 AM
019 * To change this template use File | Settings | File Templates.
020 */
021public class OLEInvoiceIngestLoadReportLookupableImpl extends LookupableImpl{
022    private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OLEInvoiceIngestLoadReportLookupableImpl.class);
023
024    /**
025     * This method will populate the search criteria and return the search results
026     *
027     * @param form
028     * @param searchCriteria
029     * @param unbounded
030     * @return searchResults(list)
031     */
032    @Override
033    protected List<?> getSearchResults(LookupForm form, Map<String, String> searchCriteria, boolean unbounded) {
034        LOG.debug("Inside getSearchResults()");
035        List<?> searchResults;
036        List<OLEInvoiceIngestLoadReport> finalSearchResult = new ArrayList<OLEInvoiceIngestLoadReport>();
037        List<OLEInvoiceIngestLoadReport> oleInvoiceIngestLoadDetails = new ArrayList<OLEInvoiceIngestLoadReport>();
038        oleInvoiceIngestLoadDetails = (List<OLEInvoiceIngestLoadReport>) super.getSearchResults(form, searchCriteria, unbounded);
039            finalSearchResult.addAll(oleInvoiceIngestLoadDetails);
040        searchResults = finalSearchResult;
041        if (searchResults.size() == 0) {
042            GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, OLEConstants.NO_RECORD_FOUND);
043        }
044        sortSearchResults(form, searchResults);
045        return searchResults;
046    }
047}