001package org.kuali.ole.deliver.lookup;
002
003import org.kuali.ole.OLEConstants;
004import org.kuali.ole.deliver.bo.OlePaymentStatus;
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: 7/16/13
018 * Time: 4:20 PM
019 * To change this template use File | Settings | File Templates.
020 */
021public class OlePaymentStatusLookupableImpl extends LookupableImpl {
022
023    @Override
024    protected List<?> getSearchResults(LookupForm form, Map<String, String> searchCriteria, boolean unbounded) {
025        List<?> searchResults;
026        List<OlePaymentStatus> finalSearchResult = new ArrayList<OlePaymentStatus>();
027        List<OlePaymentStatus> olePaymentStatus = new ArrayList<OlePaymentStatus>();
028
029
030        olePaymentStatus = (List<OlePaymentStatus>) super.getSearchResults(form, searchCriteria, unbounded);
031        finalSearchResult.addAll(olePaymentStatus);
032
033        searchResults = finalSearchResult;
034        if (searchResults.size() == 0) {
035            GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, OLEConstants.NO_RECORD_FOUND);
036        }
037        sortSearchResults(form, searchResults);
038        return searchResults;
039    }
040}