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

📄 setvobizatomstatement.java

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

import java.util.StringTokenizer;

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

/**
 * 
 * @author Administrator <br>
 *         设行数据的指定属性值 <br>
 *         格式:&lt;set-property&nbsp;&nbsp;target="待设置的行数据"
 *         properties="属性列表,以分号隔开" <br>
 *         values="设置的值列表,以分号隔开" <BR>
 *         create="true|false 如果不存在是否创建含数据" <BR>
 *         /&gt;
 */
public class SetVOBizAtomStatement extends BizAtomStatement {
    protected String target = "";

    protected String properties = "";

    protected String values = "";

    protected String create = "";

    protected void parse(EXPXMLNode node) {
        this.target = node.getAttributeValue("target");
        this.properties = node.getAttributeValue("properties");
        this.values = node.getAttributeValue("values");
        this.create = node.getAttributeValue("create");
    }

    public Object create() {
        SetVOBizAtomStatement ret = new SetVOBizAtomStatement();
        ret.target = this.target;
        ret.properties = this.properties;
        ret.values = this.values;
        ret.create = this.create;
        return ret;
    }

    public int execute(BizAutoAtomLogic function, int row)
            throws java.lang.Throwable {
        if (!"".equals(target) && !"".equals(this.properties)) {
            FunctionStack stack = function.getStack();
            Object vo = BizAutoAtomUtil.getRealValue(stack, this.target);
            if (vo == null) {
                if ("true".equalsIgnoreCase(this.create)) {
                    vo = new DefaultDataVO();
                    stack.setVariable(this.target, vo);
                } else {
                    throw new RuntimeException("变量[" + this.target + "]不存在!");
                }
            }
            setPerVO(stack, vo);
        }
        return 1;
    }

    protected void setPerVO(FunctionStack stack, Object vo) {
        if (vo != null) {
            if (!"".equals(this.values)) {
                StringTokenizer popTokens = new StringTokenizer(
                        this.properties, ";");
                StringTokenizer valuesTokens = new StringTokenizer(this.values,
                        ";");
                while (popTokens.hasMoreElements()) {
                    String property = (String) popTokens.nextElement();
                    if (valuesTokens.hasMoreElements()) {
                        SQLConverter.setProperty(property,
                                BizAutoAtomUtil.getRealValue(stack,
                                        valuesTokens.nextElement()), vo);
                    } else {
                        break;
                    }
                }
            }
        }
    }

    public String getCreate() {
        return create;
    }

    public String getName() {
        return target;
    }

    public String getProperties() {
        return properties;
    }

    public String getValues() {
        return values;
    }
}

⌨️ 快捷键说明

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