📄 findprep.bsh
字号:
/*
* $Id: findprep.bsh,v 1.8 2003/12/18 15:39:39 byersa Exp $
*
* Copyright (c) 2003 The Open For Business Project - www.ofbiz.org
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/**
*
* @author <a href="mailto:byersa@automationgroups.com">Al Byers</a>
* @version $Revision: 1.8 $
* @since 2.1
* Calls performFind service to return an EntityListIterator of the
* entities found from the parameter map selection criteria.
* Also builds a query form wrapper.
*/
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import org.ofbiz.base.util.*;
import org.ofbiz.entity.*;
import org.ofbiz.entity.util.*;
import org.ofbiz.security.*;
import org.ofbiz.service.*;
import org.ofbiz.entity.model.*;
import org.ofbiz.content.widget.html.*;
import org.ofbiz.content.widget.form.*;
import org.ofbiz.base.util.BshUtil;
import bsh.EvalError;
import java.util.ListIterator;
import javax.servlet.*;
import javax.servlet.http.*;
LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher");
inputFields = UtilHttp.getParameterMap(request);
entityName = page.getProperty("entityName");
formDefFile = page.getProperty("formDefFile");
singleFormName = page.getProperty("singleFormName");
HashMap inMap = new HashMap();
inMap.put("entityName", entityName);
//preload the query
staticConditionsStr = page.getProperty("staticConditions");
if (staticConditionsStr != null && staticConditionsStr.length() > 0) {
String [] staticConditions = BshUtil.eval("String [] cond="
+ staticConditionsStr + "; return cond;",new HashMap());
for(int i=0; i < staticConditions.length; i += 2) {
inputFields.put(staticConditions[i], staticConditions[i+1]);
}
}
Debug.logInfo("inputFields:"+ inputFields, "");
inMap.put("inputFields", inputFields);
Map result = null;
try {
result = dispatcher.runSync("performFind", inMap );
} catch (GenericServiceException e) {
request.setAttribute("_ERROR_MESSAGE_", "ERROR: Error in findLookup service. " + e.getMessage() + ")");
Debug.log(e, "findprep.bsh");
return "error";
}
listIt = (ListIterator)result.get("listIt");
request.setAttribute("listIt", listIt);
String queryString = UtilHttp.urlEncodeArgs(inputFields);
context.put("queryString", queryString);
context.put("entityName", entityName);
HtmlFormWrapper queryWrapper = new HtmlFormWrapper(formDefFile,
singleFormName, request, response);
context.put("queryWrapper", queryWrapper);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -