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

📄 xpdlreader.java

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            return;        GenericValue toolValue = delegator.makeValue("WorkflowActivityTool", null);        values.add(toolValue);        toolValue.set("packageId", packageId);        toolValue.set("packageVersion", packageVersion);        toolValue.set("processId", processId);        toolValue.set("processVersion", processVersion);        toolValue.set("activityId", activityId);        toolValue.set("toolId", toolElement.getAttribute("Id"));        if (toolElement.getAttribute("Type") != null)            toolValue.set("toolTypeEnumId", "WTT_" + toolElement.getAttribute("Type"));        else            toolValue.set("toolTypeEnumId", "WTT_PROCEDURE");        // Description?        toolValue.set("description", UtilXml.childElementValue(toolElement, "Description"));        // ActualParameters/ExtendedAttributes?        Element actualParametersElement = UtilXml.firstChildElement(toolElement, "ActualParameters");        Element extendedAttributesElement = UtilXml.firstChildElement(toolElement, "ExtendedAttributes");        List actualParameters = UtilXml.childElementList(actualParametersElement, "ActualParameter");        List extendedAttributes = UtilXml.childElementList(extendedAttributesElement, "ExtendedAttribute");        toolValue.set("actualParameters", readActualParameters(actualParameters), false);        toolValue.set("extendedAttributes", readExtendedAttributes(extendedAttributes), false);    }    protected String readActualParameters(List actualParameters) {        if (actualParameters == null || actualParameters.size() == 0) return null;        StringBuffer actualParametersBuf = new StringBuffer();        Iterator actualParametersIter = actualParameters.iterator();        while (actualParametersIter.hasNext()) {            Element actualParameterElement = (Element) actualParametersIter.next();            actualParametersBuf.append(UtilXml.elementValue(actualParameterElement));            if (actualParametersIter.hasNext())                actualParametersBuf.append(',');        }        return actualParametersBuf.toString();    }    protected String readExtendedAttributes(List extendedAttributes) {        if (extendedAttributes == null || extendedAttributes.size() == 0) return null;        Map ea = new HashMap();        Iterator i = extendedAttributes.iterator();        while (i.hasNext()) {            Element e = (Element) i.next();            ea.put(e.getAttribute("Name"), e.getAttribute("Value"));        }        return StringUtil.mapToStr(ea);    }    // ----------------------------------------------------------------    // Transition    // ----------------------------------------------------------------    protected void readTransitions(List transitions, String packageId, String packageVersion, String processId,        String processVersion) throws DefinitionParserException {        if (transitions == null || transitions.size() == 0)            return;        Iterator transitionsIter = transitions.iterator();        while (transitionsIter.hasNext()) {            Element transitionElement = (Element) transitionsIter.next();            readTransition(transitionElement, packageId, packageVersion, processId, processVersion);        }    }    protected void readTransition(Element transitionElement, String packageId, String packageVersion,        String processId, String processVersion) throws DefinitionParserException {        if (transitionElement == null)            return;        GenericValue transitionValue = delegator.makeValue("WorkflowTransition", null);        values.add(transitionValue);        String transitionId = transitionElement.getAttribute("Id");        transitionValue.set("packageId", packageId);        transitionValue.set("packageVersion", packageVersion);        transitionValue.set("processId", processId);        transitionValue.set("processVersion", processVersion);        transitionValue.set("transitionId", transitionId);        transitionValue.set("fromActivityId", transitionElement.getAttribute("From"));        transitionValue.set("toActivityId", transitionElement.getAttribute("To"));        if (transitionElement.getAttribute("Loop") != null && transitionElement.getAttribute("Loop").length() > 0)            transitionValue.set("loopTypeEnumId", "WTL_" + transitionElement.getAttribute("Loop"));        else            transitionValue.set("loopTypeEnumId", "WTL_NOLOOP");        transitionValue.set("transitionName", transitionElement.getAttribute("Name"));        // Condition?        Element conditionElement = UtilXml.firstChildElement(transitionElement, "Condition");        if (conditionElement != null) {            if (conditionElement.getAttribute("Type") != null)                transitionValue.set("conditionTypeEnumId", "WTC_" + conditionElement.getAttribute("Type"));            else                transitionValue.set("conditionTypeEnumId", "WTC_CONDITION");            // a Condition will have either a list of XPression elements, or plain PCDATA            List xPressions = UtilXml.childElementList(conditionElement, "XPression");            if (xPressions != null && xPressions.size() > 0) {                throw new DefinitionParserException("XPression elements under Condition not yet supported, just use text inside Condition with the expression");            } else {                transitionValue.set("conditionExpr", UtilXml.elementValue(conditionElement));            }        }        // Description?        transitionValue.set("description", UtilXml.childElementValue(transitionElement, "Description"));                // ExtendedAttributes?                Element extendedAttributesElement = UtilXml.firstChildElement(transitionElement, "ExtendedAttributes");              List extendedAttributes = UtilXml.childElementList(extendedAttributesElement, "ExtendedAttribute");              transitionValue.set("extendedAttributes", readExtendedAttributes(extendedAttributes), false);            }    protected void readTransitionRestrictions(List transitionRestrictions, GenericValue activityValue) throws DefinitionParserException {        if (transitionRestrictions == null || transitionRestrictions.size() == 0)            return;        Iterator transitionRestrictionsIter = transitionRestrictions.iterator();        if (transitionRestrictionsIter.hasNext()) {            Element transitionRestrictionElement = (Element) transitionRestrictionsIter.next();            readTransitionRestriction(transitionRestrictionElement, activityValue);        }        if (transitionRestrictionsIter.hasNext()) {            throw new DefinitionParserException("Multiple TransitionRestriction elements found, this is not currently supported. Please remove extras.");        }    }    protected void readTransitionRestriction(Element transitionRestrictionElement, GenericValue activityValue) throws DefinitionParserException {        String packageId = activityValue.getString("packageId");        String packageVersion = activityValue.getString("packageVersion");        String processId = activityValue.getString("processId");        String processVersion = activityValue.getString("processVersion");        String activityId = activityValue.getString("activityId");        // InlineBlock?        Element inlineBlockElement = UtilXml.firstChildElement(transitionRestrictionElement, "InlineBlock");        if (inlineBlockElement != null) {            activityValue.set("isInlineBlock", "Y");            activityValue.set("blockName", UtilXml.childElementValue(inlineBlockElement, "BlockName"));            activityValue.set("blockDescription", UtilXml.childElementValue(inlineBlockElement, "Description"));            activityValue.set("blockIconUrl", UtilXml.childElementValue(inlineBlockElement, "Icon"));            activityValue.set("blockDocumentationUrl", UtilXml.childElementValue(inlineBlockElement, "Documentation"));            activityValue.set("blockBeginActivityId", inlineBlockElement.getAttribute("Begin"));            activityValue.set("blockEndActivityId", inlineBlockElement.getAttribute("End"));        }        // Join?        Element joinElement = UtilXml.firstChildElement(transitionRestrictionElement, "Join");        if (joinElement != null) {            String joinType = joinElement.getAttribute("Type");            if (joinType != null && joinType.length() > 0) {                activityValue.set("joinTypeEnumId", "WJT_" + joinType);            }        }        // Split?        Element splitElement = UtilXml.firstChildElement(transitionRestrictionElement, "Split");        if (splitElement != null) {            String splitType = splitElement.getAttribute("Type");            if (splitType != null && splitType.length() > 0) {                activityValue.set("splitTypeEnumId", "WST_" + splitType);            }            // TransitionRefs            Element transitionRefsElement = UtilXml.firstChildElement(splitElement, "TransitionRefs");            List transitionRefs = UtilXml.childElementList(transitionRefsElement, "TransitionRef");            readTransitionRefs(transitionRefs, packageId, packageVersion, processId, processVersion, activityId);        }    }    protected void readTransitionRefs(List transitionRefs, String packageId, String packageVersion, String processId, String processVersion, String activityId) throws DefinitionParserException {                if (transitionRefs == null || transitionRefs.size() == 0)            return;        Iterator transitionRefsIter = transitionRefs.iterator();        while (transitionRefsIter.hasNext()) {            Element transitionRefElement = (Element) transitionRefsIter.next();            GenericValue transitionRefValue = delegator.makeValue("WorkflowTransitionRef", null);            values.add(transitionRefValue);            transitionRefValue.set("packageId", packageId);            transitionRefValue.set("packageVersion", packageVersion);            transitionRefValue.set("processId", processId);            transitionRefValue.set("processVersion", processVersion);            transitionRefValue.set("activityId", activityId);            transitionRefValue.set("transitionId", transitionRefElement.getAttribute("Id"));        }    }    // ----------------------------------------------------------------    // Others    // ----------------------------------------------------------------    protected void readParticipants(List participants, String packageId, String packageVersion, String processId, String processVersion, GenericValue valueObject) throws DefinitionParserException {        if (participants == null || participants.size() == 0)            return;        Iterator participantsIter = participants.iterator();                while (participantsIter.hasNext()) {            Element participantElement = (Element) participantsIter.next();            String participantId = participantElement.getAttribute("Id");            GenericValue participantValue = delegator.makeValue("WorkflowParticipant", null);                        values.add(participantValue);                        participantValue.set("packageId", packageId);            participantValue.set("packageVersion", packageVersion);            participantValue.set("processId", processId);            participantValue.set("processVersion", processVersion);            participantValue.set("participantId", participantId);            participantValue.set("participantName", participantElement.getAttribute("Name"));                        // ParticipantType            Element participantTypeElement = UtilXml.firstChildElement(participantElement, "ParticipantType");            if (participantTypeElement != null) {                participantValue.set("participantTypeId", participantTypeElement.getAttribute("Type"));            }            // Description?            participantValue.set("description", UtilXml.childElementValue(participantElement, "Description"));            // ExtendedAttributes            participantValue.set("partyId", getExtendedAttributeValue(participantElement, "partyId", null), false);            participantValue.set("roleTypeId", getExtendedAttributeValue(participantElement, "roleTypeId", null), false);                    }    }        /*    protected void readParticipants(List participants, String packageId, String packageVersion, String processId, String processVersion, GenericValue valueObject) throws DefinitionParserException {        if (participants == null || participants.size() == 0)            return;        Long nextSeqId = delegator.getNextSeqId("WorkflowParticipantList");        if (nextSeqId == null)            throw new DefinitionParserException("Could not get next sequence id from data source");        String participantListId = nextSeqId.toString();        valueObject.set("participantListId", participantListId);

⌨️ 快捷键说明

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