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

📄 wfapplicationservices.java

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * $Id: WfApplicationServices.java 5462 2005-08-05 18:35:48Z jonesde $ * * Copyright (c) 2001, 2002 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. * */package org.ofbiz.workflow;import java.io.IOException;import java.sql.Timestamp;import java.util.ArrayList;import java.util.Collection;import java.util.Date;import java.util.HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;import javax.xml.parsers.ParserConfigurationException;import org.ofbiz.base.util.Debug;import org.ofbiz.base.util.GeneralException;import org.ofbiz.base.util.ObjectType;import org.ofbiz.base.util.UtilMisc;import org.ofbiz.entity.GenericDelegator;import org.ofbiz.entity.GenericEntityException;import org.ofbiz.entity.GenericValue;import org.ofbiz.entity.serialize.SerializeException;import org.ofbiz.entity.serialize.XmlSerializer;import org.ofbiz.service.DispatchContext;import org.ofbiz.service.GenericServiceException;import org.ofbiz.service.ModelService;import org.xml.sax.SAXException;/** * Workflow Application Services - 'Services' and 'Workers' for interaction with Workflow Application API * * @author     Manuel Soto & Oswin Ondarza * @version    $Rev: 5462 $ * @since      2.0 */public class WfApplicationServices {    // -------------------------------------------------------------------    // Appication 'Service' Methods    // -------------------------------------------------------------------    public static final String module = WfApplicationServices.class.getName();    /**      * Activate an application by inserting expected arguments in     * the ApplicationSandbox table.     *     * Note: Assume that the activity (workEffort) has only one performer as     * defined in XPDL specification, this means that there is only one     * partyAssigment w/ CAL_ACEPTED state.     * @param ctx Service dispatch Context     * @param context Actual parameters     * @throws GenericServiceException     * @return Empty result     */    public static Map activateApplication(DispatchContext ctx, Map context) {        final String workEffortId = (String) context.get("workEffortId");        final Map result = new HashMap();        try {            final GenericValue weAssigment = getWorkEffortPartyAssigment(ctx.getDelegator(), workEffortId);            final String partyId = (String) weAssigment.get("partyId");            final String roleTypeId = (String) weAssigment.get("roleTypeId");            final Timestamp fromDate = (Timestamp) weAssigment.get("fromDate");            result.put("applicationId", insertAppSandbox(ctx.getDelegator(), workEffortId, partyId,                     roleTypeId, fromDate, context));                                            result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);        } catch (GenericServiceException we) {            we.printStackTrace();            result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR);            result.put(ModelService.ERROR_MESSAGE, we.getMessage());        }        return result;    }    public static Map getApplicationContext(DispatchContext ctx, Map context) throws GenericServiceException {        final GenericDelegator delegator = ctx.getDelegator();        final Map result = new HashMap();        try {            result.put("applicationContext",                     getRunTimeContext(delegator, getRuntimeData(delegator, (String) context.get("applicationId"))));                                            result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);        } catch (GenericServiceException we) {            we.printStackTrace();            result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR);            result.put(ModelService.ERROR_MESSAGE, we.getMessage());        }        return result;    }    public static Map completeApplication(DispatchContext ctx, Map context) throws GenericServiceException {        final GenericDelegator delegator = ctx.getDelegator();        final String applicationId = (String) context.get("applicationId");        final Map result = new HashMap();        GenericValue application = getApplicationSandbox(delegator, applicationId);        GenericValue runTimeData = getRuntimeData(delegator, applicationId);        Map runTimeContext = getRunTimeContext(delegator, runTimeData);        Map contextSignature = new HashMap();        Map resultSignature = new HashMap();        Map resultContext = new HashMap();        Map runContext = new HashMap(context);        try {            // copy all OUT & INOUT formal parameters            getApplicationSignatures(delegator, application, contextSignature, resultSignature);            for (Iterator names = resultSignature.keySet().iterator(); names.hasNext();) {                String name = (String) names.next();                Object value = null;                if (runTimeContext.containsKey(name)                    && contextSignature.containsKey(name)                    && resultSignature.containsKey(name))                    value = runTimeContext.get(name);                if (((Map) context.get("result")).containsKey(name))                    value = ((Map) context.get("result")).get(name);                if (value != null)                    resultContext.put(name,                                                    ObjectType.simpleTypeConvert(value, (String) resultSignature.get(name), null, null));            }            runTimeContext.putAll(resultContext);            // fin de agregar            if (Debug.verboseOn()) {                Debug.logVerbose("Completing Application: " + applicationId, module);                Debug.logVerbose("  Result Signature: " + resultSignature.toString(), module);                Debug.logVerbose("  Result Values: " + resultContext.toString(), module);            }            setRunTimeContext(runTimeData, runTimeContext);            // agregado por Oswin Ondarza            runContext.remove("applicationId");            final String workEffortId = (String) runTimeContext.get("workEffortId");            final Timestamp fromDate = (Timestamp) application.get("fromDate");            final String partyId = (String) application.get("partyId");            final String roleTypeId = (String) application.get("roleTypeId");            runContext.put("workEffortId", workEffortId);            runContext.put("fromDate", fromDate);            runContext.put("partyId", partyId);            runContext.put("roleTypeId", roleTypeId);            runContext.put("result", resultContext);            result.putAll(ctx.getDispatcher().runSync("wfCompleteAssignment", runContext));

⌨️ 快捷键说明

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