⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addprep.bsh

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 BSH
字号:
/* * $Id: addprep.bsh 5462 2005-08-05 18:35:48Z jonesde $ * * 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. * */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.security.*;import org.ofbiz.service.*;import org.ofbiz.entity.model.*;import org.ofbiz.widget.html.*;import org.ofbiz.widget.form.*;import javax.servlet.*;import javax.servlet.http.*;/** * * @author     <a href="mailto:byersa@automationgroups.com">Al Byers</a> * @version    $Rev: 5462 $ * @since      2.2 */security			= request.getAttribute("security");// Get permission from pagedef config fileString permission		= page.getProperty("permission");String formDefFile		= page.getProperty("formDefFile");String singleFormName		= page.getProperty("singleFormName");String entityName		= page.getProperty("entityName");String priKeyName		= page.getProperty("priKeyName");String defaultMapName		= page.getProperty("defaultMapName");if( defaultMapName == null) defaultMapName	= "currentValue";String entityOperation		= page.getProperty("entityOperation");if( entityOperation == null) entityOperation	= "_ADMIN";dispatcher      = (LocalDispatcher)request.getAttribute("dispatcher");delegator = (GenericDelegator) request.getAttribute("delegator");mapIn = new HashMap();userLogin = session.getAttribute("userLogin");mapIn.put("userLogin", userLogin);mapIn.put("entityOperation", entityOperation);// Since we don't know the purpose for the Content to be entered, at least// check that the user has permission to enter some Contentlst = delegator.findAllCache("ContentPurposeType");iter = lst.iterator();contentPurposeList = new ArrayList();while (iter.hasNext()) {    purpose = (GenericValue)iter.next();    contentPurposeTypeId = (String)purpose.get( "contentPurposeTypeId");    contentPurposeList.add(contentPurposeTypeId);}mapIn.put("contentPurposeList", contentPurposeList);//contentPropertiesUrl = application.getResource("content.properties");ownerContentId = UtilProperties.getPropertyValue("content.properties", "owner.content.id");org.ofbiz.base.util.Debug.logInfo("ownerContentId:" + ownerContentId, null);genericValue = delegator.makeValue(entityName, null);genericValue.put("ownerContentId", ownerContentId);mapIn.put("currentContent", genericValue);List targetOperationList = UtilMisc.toList("CREATE_CONTENT");mapIn.put("targetOperationList", targetOperationList );org.ofbiz.base.util.Debug.logInfo("before runSync, mapIn:" + mapIn, null);result = dispatcher.runSync("checkContentPermission", mapIn);org.ofbiz.base.util.Debug.logInfo("result:" + result, null);permissionStatus = result.get("permissionStatus");org.ofbiz.base.util.Debug.logInfo("permissionStatus:" + permissionStatus, null);if (permissionStatus != null && permissionStatus.equals("granted")) {        context.put("hasPermission", Boolean.TRUE);} else {        context.put("hasPermission", Boolean.FALSE);}    HtmlFormWrapper addWrapper = new HtmlFormWrapper(formDefFile, 				singleFormName, request, response);addWrapper.putInContext(defaultMapName, genericValue);// The idea here is that by setting the map name here, dependency on the         // widget-form config file could be eliminated.ModelForm modelForm	= addWrapper.getModelForm();modelForm.setDefaultMapName(defaultMapName);roles = result.get("roleTypeList");allowedPurposes = new ArrayList();pIter = contentPurposeList.iterator();while ( pIter.hasNext() ) {    purpose = (String)pIter.next();    purposeList = new ArrayList();    purposeList.add(purpose);    mapIn.put("contentPurposeList", purposeList);    resultPurpose = dispatcher.runSync("checkContentPermission", mapIn);    org.ofbiz.base.util.Debug.logInfo("resultPurpose:" + resultPurpose, null);    permissionStatus = resultPurpose.get("permissionStatus");    org.ofbiz.base.util.Debug.logInfo("permissionStatus:" + permissionStatus, null);    if (permissionStatus != null && permissionStatus.equals("granted")) {        purposeValue = delegator.findByPrimaryKey("ContentPurposeType",                                    UtilMisc.toMap("contentPurposeTypeId", purpose));        allowedPurposes.add(purposeValue);    }}addWrapper.putInContext("allowedPurposes", allowedPurposes);context.put("editWrapper", addWrapper);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -