001package org.kuali.ole.deliver.lookup;
002
003import org.kuali.ole.OLEConstants;
004import org.kuali.ole.deliver.bo.OleSourceBo;
005import org.kuali.rice.krad.lookup.LookupableImpl;
006import org.kuali.rice.krad.util.GlobalVariables;
007import org.kuali.rice.krad.util.KRADConstants;
008import org.kuali.rice.krad.web.form.LookupForm;
009
010import java.util.ArrayList;
011import java.util.List;
012import java.util.Map;
013
014/**
015 * Created with IntelliJ IDEA.
016 * User: asham
017 * Date: 8/19/13
018 * Time: 5:37 PM
019 * To change this template use File | Settings | File Templates.
020 */
021public class OleSourceBoLookupableImpl extends LookupableImpl {
022    @Override
023    protected List<?> getSearchResults(LookupForm form, Map<String, String> searchCriteria, boolean unbounded) {
024        List<?> searchResults;
025        List<OleSourceBo> finalSearchResult = new ArrayList<OleSourceBo>();
026        List<OleSourceBo> oleSourceBo = new ArrayList<OleSourceBo>();
027        oleSourceBo = (List<OleSourceBo>) super.getSearchResults(form, searchCriteria, unbounded);
028        finalSearchResult.addAll(oleSourceBo);
029
030        searchResults = finalSearchResult;
031
032        if (searchResults.size() == 0) {
033            GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, OLEConstants.NO_RECORD_FOUND);
034        }
035        sortSearchResults(form, searchResults);
036        return searchResults;
037    }
038}