001/* 002 * Copyright 2012 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 1.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/ecl1.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 */ 016package org.kuali.ole.select.lookup; 017 018import org.kuali.ole.sys.OLEConstants; 019import org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl; 020import org.kuali.rice.kns.web.struts.form.LookupForm; 021import org.kuali.rice.kns.web.ui.Field; 022import org.kuali.rice.kns.web.ui.Row; 023import org.kuali.rice.krad.bo.BusinessObject; 024import java.util.Iterator; 025import java.util.List; 026import java.util.Map; 027 028public class OleLoadSumRecordLookupableHelperServiceImpl extends KualiLookupableHelperServiceImpl { 029 030 @Override 031 public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues) { 032 String fileName = fieldValues.get("fileName"); 033 if (!fileName.contains("*")) { 034 StringBuilder loadFileName = new StringBuilder(); 035 loadFileName.append("*"); 036 loadFileName.append(fileName); 037 loadFileName.append("*"); 038 fieldValues.put("fileName", loadFileName.toString()); 039 } 040 return super.getSearchResults(fieldValues); 041 } 042 043 @Override 044 public void performClear(LookupForm lookupForm){ 045 super.performClear(lookupForm); 046 for (Iterator iter = this.getRows().iterator(); iter.hasNext();) { 047 Row row = (Row) iter.next(); 048 for (Iterator iterator = row.getFields().iterator(); iterator.hasNext();) { 049 Field field = (Field) iterator.next(); 050 if(field.getPropertyName().equalsIgnoreCase(OLEConstants.PRINCIPAL_ID)){ 051 field.setPropertyValue(null); 052 } 053 } 054 } 055 } 056 057}