001    /**
002     * Copyright 2004-2012 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.hr.time;
017    
018    import java.util.List;
019    import java.util.Map;
020    
021    import org.apache.commons.lang.StringUtils;
022    import org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl;
023    import org.kuali.rice.krad.bo.BusinessObject;
024    
025    public class TkLookupableHelper extends KualiLookupableHelperServiceImpl {
026    
027            /**
028             * 
029             */
030            private static final long serialVersionUID = 1L;
031    
032            @Override
033            public List<? extends BusinessObject> getSearchResults(
034                            Map<String, String> fieldValues) {
035                    if (fieldValues.containsKey("workArea")
036                                    && StringUtils.equals(fieldValues.get("workArea"), "%")) {
037                            fieldValues.put("workArea", "");
038                    }
039                    if (fieldValues.containsKey("jobNumber")
040                                    && StringUtils.equals(fieldValues.get("jobNumber"), "%")) {
041                            fieldValues.put("jobNumber", "");
042                    }
043                    return super.getSearchResults(fieldValues);
044            }
045    
046            @Override
047            protected void validateSearchParameterWildcardAndOperators(
048                            String attributeName, String attributeValue) {
049                    if (!StringUtils.equals(attributeValue, "%")) {
050                            super.validateSearchParameterWildcardAndOperators(attributeName,
051                                            attributeValue);
052                    }
053            }
054    
055    }