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

📄 wfapplicationservices.java

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        } catch (GenericEntityException we) {            we.printStackTrace();            result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR);            result.put(ModelService.ERROR_MESSAGE, we.getMessage());        } catch (GenericServiceException we) {            we.printStackTrace();            result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR);            result.put(ModelService.ERROR_MESSAGE, we.getMessage());        } catch (GeneralException ge) {            ge.printStackTrace();            result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR);            result.put(ModelService.ERROR_MESSAGE, ge.getMessage());        }        return result;    }    private static String insertAppSandbox(GenericDelegator delegator, String workEffortId, String partyId,             String roleTypeId, Timestamp fromDate, Map context) throws GenericServiceException {        String dataId = null;        String infoId = null;        String applicationId = new String(new Long((new Date().getTime())).toString());                try {            dataId = delegator.getNextSeqId("RuntimeData").toString();            GenericValue runtimeData = delegator.makeValue("RuntimeData", UtilMisc.toMap("runtimeDataId", dataId));            runtimeData.set("runtimeInfo", XmlSerializer.serialize(context));            delegator.create(runtimeData);        } catch (GenericEntityException ee) {            throw new GenericServiceException(ee.getMessage(), ee);        } catch (SerializeException se) {            throw new GenericServiceException(se.getMessage(), se);        } catch (IOException ioe) {            throw new GenericServiceException(ioe.getMessage(), ioe);        }        Map aFields = UtilMisc.toMap("applicationId", applicationId, "workEffortId", workEffortId,                 "partyId", partyId, "roleTypeId", roleTypeId, "fromDate", fromDate, "runtimeDataId", dataId);        GenericValue appV = null;        try {            appV = delegator.makeValue("ApplicationSandbox", aFields);            delegator.create(appV);        } catch (GenericEntityException e) {            throw new GenericServiceException(e.getMessage(), e);        }        return applicationId;    }    private static GenericValue getApplicationSandbox(GenericDelegator delegator, String applicationId)            throws GenericServiceException {        try {            GenericValue application =                delegator.findByPrimaryKey("ApplicationSandbox", UtilMisc.toMap("applicationId", applicationId));            return application;        } catch (GenericEntityException ee) {            throw new GenericServiceException(ee.getMessage(), ee);        }    }    private static Map getRunTimeContext(GenericDelegator delegator, GenericValue runTimeData)            throws GenericServiceException {        try {            return (Map) XmlSerializer.deserialize((String) runTimeData.get("runtimeInfo"), delegator);        } catch (SerializeException se) {            throw new GenericServiceException(se.getMessage(), se);        } catch (ParserConfigurationException pe) {            throw new GenericServiceException(pe.getMessage(), pe);        } catch (SAXException se) {            throw new GenericServiceException(se.getMessage(), se);        } catch (IOException ioe) {            throw new GenericServiceException(ioe.getMessage(), ioe);        }    }    private static void setRunTimeContext(GenericValue runTimeData, Map context) throws GenericServiceException {        try {            runTimeData.set("runtimeInfo", XmlSerializer.serialize(context));            runTimeData.store();        } catch (GenericEntityException ee) {            throw new GenericServiceException(ee.getMessage(), ee);        } catch (SerializeException se) {            throw new GenericServiceException(se.getMessage(), se);        } catch (IOException ioe) {            throw new GenericServiceException(ioe.getMessage(), ioe);        }    }    private static GenericValue getRuntimeData(GenericDelegator delegator, String applicationId)            throws GenericServiceException {        try {            GenericValue application =                delegator.findByPrimaryKey("ApplicationSandbox", UtilMisc.toMap("applicationId", applicationId));            return application.getRelatedOne("RuntimeData");        } catch (GenericEntityException ee) {            throw new GenericServiceException(ee.getMessage(), ee);        }    }    private static void getApplicationSignatures(GenericDelegator delegator, GenericValue application,             Map contextSignature, Map resultSignature) throws GenericEntityException {             Map expresions = null;           // look for the 1st application.        final GenericValue workEffort =            delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", application.get("workEffortId")));        String packageId = (String) workEffort.get("workflowPackageId");        String packageVersion = (String) workEffort.get("workflowPackageVersion");        String processId = (String) workEffort.get("workflowProcessId");        String processVersion = (String) workEffort.get("workflowProcessVersion");        String activityId = (String) workEffort.get("workflowActivityId");        expresions = new HashMap();        expresions.putAll(UtilMisc.toMap("packageId", packageId));        expresions.putAll(UtilMisc.toMap("packageVersion", packageVersion));        expresions.putAll(UtilMisc.toMap("processId", processId));        expresions.putAll(UtilMisc.toMap("processVersion", processVersion));        expresions.putAll(UtilMisc.toMap("activityId", activityId));        final Collection wfActivityTools = delegator.findByAnd("WorkflowActivityTool", expresions);        final GenericValue wfActivityTool = (GenericValue) wfActivityTools.toArray()[0];        packageId = (String) wfActivityTool.get("packageId");        packageVersion = (String) wfActivityTool.get("packageVersion");        processId = (String) wfActivityTool.get("processId");        processVersion = (String) wfActivityTool.get("processVersion");        final String applicationId = (String) wfActivityTool.get("toolId");        expresions = new HashMap();        expresions.putAll(UtilMisc.toMap("packageId", packageId));        expresions.putAll(UtilMisc.toMap("packageVersion", packageVersion));        expresions.putAll(UtilMisc.toMap("processId", processId));        expresions.putAll(UtilMisc.toMap("processVersion", processVersion));        expresions.putAll(UtilMisc.toMap("applicationId", applicationId));        final Collection params = delegator.findByAnd("WorkflowFormalParam", expresions);        Iterator i = params.iterator();        while (i.hasNext()) {            GenericValue param = (GenericValue) i.next();            String name = param.getString("formalParamId");            String mode = param.getString("modeEnumId");            String type = param.getString("dataTypeEnumId");            if (mode.equals("WPM_IN") || mode.equals("WPM_INOUT"))                contextSignature.put(name, WfUtil.getJavaType(type));            else if (mode.equals("WPM_OUT") || mode.equals("WPM_INOUT"))                resultSignature.put(name, WfUtil.getJavaType(type));        }    }    private static GenericValue getWorkEffortPartyAssigment(GenericDelegator delegator, String workEffortId)            throws GenericServiceException {        Map expresions = new HashMap();        expresions.putAll(UtilMisc.toMap("workEffortId", workEffortId));        expresions.putAll(UtilMisc.toMap("statusId", "CAL_ACCEPTED"));        List orderBy = new ArrayList();        orderBy.add("-fromDate");        try {            final Collection assigments = delegator.findByAnd("WorkEffortPartyAssignment", expresions, orderBy);            GenericValue assigment;            if (assigments.isEmpty()) {                Debug.logError("No accepted activities found for the workEffortId=" + workEffortId, module);                throw new GenericServiceException("Can not find WorkEffortPartyAssignment for the Workflow service. WorkEffortId=" + workEffortId);                                }            if (assigments.size() != 1)                Debug.logWarning("More than one accepted activities found for the workEffortId=" + workEffortId, module);            return (GenericValue) assigments.iterator().next();        } catch (GenericEntityException ee) {            throw new GenericServiceException(ee.getMessage(), ee);        }    }}

⌨️ 快捷键说明

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