001package org.kuali.ole.pdp;
002
003import org.kuali.ole.sys.OLEConstants;
004import org.kuali.ole.OleLookupableImpl;
005import org.kuali.rice.krad.bo.BusinessObject;
006import org.kuali.rice.krad.lookup.LookupableImpl;
007
008import java.util.Collection;
009import java.util.HashMap;
010import java.util.List;
011import java.util.Map;
012
013/**
014 * Created with IntelliJ IDEA.
015 * User: anithaa
016 * Date: 10/24/14
017 * Time: 2:47 PM
018 * To change this template use File | Settings | File Templates.
019 */
020public class FormatProcessLookupableImpl extends OleLookupableImpl {
021    protected Collection<?> executeSearch(Map<String, String> adjustedSearchCriteria,
022                                          List<String> wildcardAsLiteralSearchCriteria, boolean bounded, Integer searchResultsLimit) {
023
024
025        if ((adjustedSearchCriteria.containsKey(OLEConstants.BEGIN_FORMAT_FROM_DATE) && (adjustedSearchCriteria.containsKey(OLEConstants.BEGIN_FORMAT_TO_DATE)))) {
026            adjustedSearchCriteria.put(OLEConstants.BEGIN_FORMAT, adjustedSearchCriteria.get(OLEConstants.BEGIN_FORMAT_FROM_DATE).concat("..").concat(adjustedSearchCriteria.get(OLEConstants.BEGIN_FORMAT_TO_DATE)));
027
028        } else if (adjustedSearchCriteria.containsKey(OLEConstants.BEGIN_FORMAT_FROM_DATE)) {
029            String greaterthan = new String(">=");
030            adjustedSearchCriteria.put(OLEConstants.BEGIN_FORMAT, greaterthan.concat(adjustedSearchCriteria.get(OLEConstants.BEGIN_FORMAT_FROM_DATE)));
031        } else if (adjustedSearchCriteria.containsKey(OLEConstants.BEGIN_FORMAT_TO_DATE)) {
032            String lessthan = new String("<=");
033            adjustedSearchCriteria.put(OLEConstants.BEGIN_FORMAT, lessthan.concat(adjustedSearchCriteria.get(OLEConstants.BEGIN_FORMAT_TO_DATE)));
034        }
035        adjustedSearchCriteria.remove(OLEConstants.BEGIN_FORMAT_FROM_DATE);
036        adjustedSearchCriteria.remove(OLEConstants.BEGIN_FORMAT_TO_DATE);
037
038        return super.executeSearch(adjustedSearchCriteria, wildcardAsLiteralSearchCriteria, bounded, searchResultsLimit);
039    }
040
041
042
043}