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

📄 layoutevents.java

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                serviceIn.put("fromDate", UtilDateTime.nowTimestamp());                serviceIn.put("thruDate", null);                try {                    results = dispatcher.runSync("persistContentAndAssoc", serviceIn);                } catch(GenericServiceException e) {                    request.setAttribute("_ERROR_MESSAGE_", e.getMessage());                    return "error";                }                beenThere.put(contentIdFrom, view);            }                 }        GenericValue view = delegator.makeValue("ContentDataResourceView", null);        view.set("contentId", newId);        view.set("drDataResourceId", newDataResourceId);        Debug.logVerbose("in cloneLayout, view:" + view, "");        ContentManagementWorker.setCurrentEntityMap(request, view);         request.setAttribute("contentId", view.get("contentId"));        request.setAttribute("drDataResourceId", view.get("drDataResourceId"));        return "success";    }    public static String createLayoutSubContent(HttpServletRequest request, HttpServletResponse response) {               try {            LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher");            HttpSession session = request.getSession();            Map paramMap = UtilHttp.getParameterMap(request);            String contentIdTo = (String)paramMap.get("contentIdTo");            String mapKey = (String)paramMap.get("mapKey");            if (Debug.verboseOn()) {                 Debug.logVerbose("in createSubContent, contentIdTo:" + contentIdTo, module);                Debug.logVerbose("in createSubContent, mapKey:" + mapKey, module);            }            Map context = new HashMap();            List errorMessages = null;            Locale loc = (Locale)request.getSession().getServletContext().getAttribute("locale");            if (loc == null)                 loc = Locale.getDefault();            GenericValue userLogin = (GenericValue)session.getAttribute("userLogin");            context.put("userLogin", userLogin);            String rootDir = request.getSession().getServletContext().getRealPath("/");             context.put("rootDir", rootDir);            try {                SimpleMapProcessor.runSimpleMapProcessor(                      "org/ofbiz/content/ContentManagementMapProcessors.xml", "contentIn",                      paramMap, context, errorMessages, loc);                SimpleMapProcessor.runSimpleMapProcessor(                      "org/ofbiz/content/ContentManagementMapProcessors.xml", "dataResourceIn",                      paramMap, context, errorMessages, loc);                SimpleMapProcessor.runSimpleMapProcessor(                      "org/ofbiz/content/ContentManagementMapProcessors.xml", "contentAssocIn",                      paramMap, context, errorMessages, loc);            } catch(MiniLangException e) {                request.setAttribute("_ERROR_MESSAGE_", e.getMessage());                return "error";            }            context.put("dataResourceName", context.get("contentName"));            String contentPurposeTypeId = (String)paramMap.get("contentPurposeTypeId");            if (UtilValidate.isNotEmpty(contentPurposeTypeId))                context.put("contentPurposeList", UtilMisc.toList(contentPurposeTypeId));            context.put("contentIdTo", paramMap.get("contentIdTo"));            context.put("mapKey", paramMap.get("mapKey"));            context.put("textData", paramMap.get("textData"));            context.put("contentAssocTypeId", "SUB_CONTENT");            if (Debug.verboseOn()) Debug.logVerbose("in createSubContent, context:" + context, module);            Map result = dispatcher.runSync("persistContentAndAssoc", context);            boolean isError = ModelService.RESPOND_ERROR.equals(result.get(ModelService.RESPONSE_MESSAGE));            if (isError) {                request.setAttribute("_ERROR_MESSAGE_", result.get(ModelService.ERROR_MESSAGE));                return "error";            }            if (Debug.verboseOn()) Debug.logVerbose("in createLayoutFile, result:" + result, module);            String contentId = (String)result.get("contentId");            String dataResourceId = (String)result.get("dataResourceId");            request.setAttribute("contentId", contentId);            request.setAttribute("drDataResourceId", dataResourceId);            request.setAttribute("currentEntityName", "SubContentDataResourceId");            Map context2 = new HashMap();            context2.put("activeContentId", contentId);            //context2.put("dataResourceId", dataResourceId);            context2.put("contentAssocTypeId", "SUB_CONTENT");            context2.put("fromDate", result.get("fromDate"));            context2.put("contentIdTo", contentIdTo);            context2.put("mapKey", mapKey);                //Debug.logVerbose("in replaceSubContent, context2:" + context2, module);            Map result2 = dispatcher.runSync("deactivateAssocs", context2);        } catch( GenericServiceException e) {            request.setAttribute("_ERROR_MESSAGE_", e.getMessage());            return "error";        }        return "success";    }    public static String updateLayoutSubContent(HttpServletRequest request, HttpServletResponse response) {               try {            LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher");            HttpSession session = request.getSession();            Map paramMap = UtilHttp.getParameterMap(request);            String contentIdTo = (String)paramMap.get("contentIdTo");            String mapKey = (String)paramMap.get("mapKey");            Map context = new HashMap();            List errorMessages = null;            Locale loc = (Locale)request.getSession().getServletContext().getAttribute("locale");            if (loc == null)                 loc = Locale.getDefault();            context.put("locale", loc);            GenericValue userLogin = (GenericValue)session.getAttribute("userLogin");            context.put("userLogin", userLogin);            String rootDir = request.getSession().getServletContext().getRealPath("/");             context.put("rootDir", rootDir);            try {                SimpleMapProcessor.runSimpleMapProcessor(                      "org/ofbiz/content/ContentManagementMapProcessors.xml", "contentIn",                      paramMap, context, errorMessages, loc);                SimpleMapProcessor.runSimpleMapProcessor(                      "org/ofbiz/content/ContentManagementMapProcessors.xml", "dataResourceIn",                      paramMap, context, errorMessages, loc);                SimpleMapProcessor.runSimpleMapProcessor(                      "org/ofbiz/content/ContentManagementMapProcessors.xml", "contentAssocIn",                      paramMap, context, errorMessages, loc);            } catch(MiniLangException e) {                request.setAttribute("_ERROR_MESSAGE_", e.getMessage());                return "error";            }            context.put("dataResourceName", context.get("contentName"));            String contentPurposeTypeId = (String)paramMap.get("contentPurposeTypeId");            if (UtilValidate.isNotEmpty(contentPurposeTypeId))                context.put("contentPurposeList", UtilMisc.toList(contentPurposeTypeId));            context.put("contentIdTo", paramMap.get("contentIdTo"));            context.put("textData", paramMap.get("textData"));            context.put("contentAssocTypeId", null);            Map result = dispatcher.runSync("persistContentAndAssoc", context);            boolean isError = ModelService.RESPOND_ERROR.equals(result.get(ModelService.RESPONSE_MESSAGE));            if (isError) {                request.setAttribute("_ERROR_MESSAGE_", result.get(ModelService.ERROR_MESSAGE));                return "error";            }            String contentId = (String)result.get("contentId");            String dataResourceId = (String)result.get("dataResourceId");            request.setAttribute("contentId", contentId);            request.setAttribute("drDataResourceId", dataResourceId);            request.setAttribute("currentEntityName", "SubContentDataResourceId");            /*            Map context2 = new HashMap();            context2.put("activeContentId", contentId);            //context2.put("dataResourceId", dataResourceId);            context2.put("contentAssocTypeId", "SUB_CONTENT");            context2.put("fromDate", result.get("fromDate"));            context2.put("contentIdTo", contentIdTo);            context2.put("mapKey", mapKey);                //Debug.logVerbose("in replaceSubContent, context2:" + context2, module);            Map result2 = dispatcher.runSync("deactivateAssocs", context2);            */        } catch( GenericServiceException e) {            request.setAttribute("_ERROR_MESSAGE_", e.getMessage());            return "error";        }        return "success";    }    public static String copyToClip(HttpServletRequest request, HttpServletResponse response) {        GenericDelegator delegator = (GenericDelegator)request.getAttribute("delegator");        Map paramMap = UtilHttp.getParameterMap(request);        String entityName = (String)paramMap.get("entityName");        Locale locale = UtilHttp.getLocale(request);                        if (UtilValidate.isEmpty(entityName) ) {            String errMsg = UtilProperties.getMessage(LayoutEvents.err_resource, "layoutEvents.entityname_empty", locale);            request.setAttribute("_ERROR_MESSAGE_", errMsg);            return "error";        }         GenericValue v = delegator.makeValue(entityName, null);        GenericPK passedPK = v.getPrimaryKey();        Collection keyColl = passedPK.getAllKeys();        Iterator keyIt = keyColl.iterator();        while (keyIt.hasNext()) {            String attrName = (String)keyIt.next();            String attrVal = (String)request.getAttribute(attrName);            if (attrVal == null) {                attrVal = (String)paramMap.get(attrName);            }        Debug.logVerbose("in copyToClip, attrName:" + attrName,"");        Debug.logVerbose("in copyToClip, attrVal:" + attrVal,"");            if (UtilValidate.isNotEmpty(attrVal)) {                passedPK.put(attrName,attrVal);            } else {                String errMsg = UtilProperties.getMessage(LayoutEvents.err_resource, "layoutEvents.empty", locale);                request.setAttribute("_ERROR_MESSAGE_", attrName + " " + errMsg);                return "error";            }        }        ContentManagementWorker.mruAdd(request, passedPK);        return "success";    }}

⌨️ 快捷键说明

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