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

📄 conditionbizatomstatement.java

📁 这个是使用java开发的一个平台
💻 JAVA
字号:
package com.exp.bizatom.auto.statement;

import com.exp.bizatom.auto.BizAutoAtomLogic;
import com.exp.bizatom.auto.BizAutoAtomUtil;
import com.exp.bizatom.auto.FunctionStack;
import com.exp.fcl.xml.EXPXMLNode;

public class ConditionBizAtomStatement extends BizAtomStatement {
    protected String depend;

    protected String rule;

    protected void parse(EXPXMLNode node) {
        this.depend = node.getAttributeValue("depend");
        this.rule = node.getAttributeValue("rule");
    }

    public Object create() {
        ConditionBizAtomStatement ret = new ConditionBizAtomStatement();
        ret.depend = this.depend;
        ret.rule = this.rule;
        return ret;
    }

    public int execute(BizAutoAtomLogic function, int row)
            throws java.lang.Throwable {
        boolean bMatch = false;
        if (!"".equals(depend)) {
            Object vo = BizAutoAtomUtil.getRealValue(function.getStack(),
                    this.depend);

            if (vo != null) {
                bMatch = this.matchRule(vo.toString(), this.rule, function
                        .getStack());
            } else {
                bMatch = this.matchRule(null, this.rule, function.getStack());
            }
        }
        return bMatch ? 101 : 102;
    }

    protected boolean matchRule(String dependValue, String disableRule,
            FunctionStack stack) {
        if ("".equals(disableRule)) {
            return false;
        }
        if ("null".equalsIgnoreCase(disableRule)) {
            if (dependValue == null) {
                return true;
            }
        } else if ("empty".equalsIgnoreCase(disableRule)) {
            if ("".equals(dependValue)) {
                return true;
            }
        } else if (disableRule.startsWith("!")) {
            String ref = disableRule.substring(1);
            Object exceptedValue = BizAutoAtomUtil.getRealValue(stack, ref);
            if (exceptedValue == null) {
                return dependValue != null;
            } else {
                return !exceptedValue.equals(dependValue);
            }
        } else {
            Object exceptedValue = BizAutoAtomUtil.getRealValue(stack,
                    disableRule);
            if (exceptedValue == null) {
                return dependValue == null;
            } else {
                return exceptedValue.equals(dependValue);
            }
        }
        return false;
    }

}

⌨️ 快捷键说明

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