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

📄 parameterofindef.java

📁 最近项目中用到了Struts ,但是我不会用
💻 JAVA
字号:
package cn.com.lomtom.query.view;

import java.io.*;

import javax.servlet.http.*;

import cn.com.lomtom.commons.*;
import org.apache.struts.action.*;

public class ParameterOfInDef extends ActionForm implements Serializable {
    public final static int MANUALINPUT = 1;
    public final static int SYSTEMPARAM = 2;
    public final static int CURRENTDATE = 3;
    public final static int CURRENTTIME = 4;
    public final static int CURRENTTIMESTAMP = 5;
    public final static int CURRENTUSERID = 6;
    public final static int CURRENTUSERNAME = 7;
    public final static int CURRENTUSERORGID = 8;
    private String queryId = ""; //查询标识
    private int parameterNumber = 0; //参数序号
    private String parameterName = ""; //参数名称
    private String parameterType = ""; //参数类型
    private String hasCode = ""; //是否代码项
    private String codeType = ""; //代码类型
    private String parameterFormat = ""; //输入参数格式
    private String defaultValue = ""; //缺省值
    private String notDateValue = ""; //非日期格式的缺省值(非数据库中字段)---Added by xiekebai
    private String dateValue = ""; //日期格式的缺省值(非数据库中字段)---Added by xiekebai
    private String aideDateValue = ""; //由于dateValue绑定了一个下拉列表,进入页面默认为空,所以显示日期需要借助该字段进行显示
    private String txtday = ""; //用户输入的天数(非数据库中字段)---Added by xiekebai
    private String subtractDay = ""; //参数来源中所设置的日期需要减去的天数
    private String isNeed = ""; //是否必输项
    private String proPara = ""; //是否为存储过程参数
    private String value = ""; //输入参数值
    private String allowSelectAll = "1";
    private String subCode = ""; //子代码名称
    private String subName = ""; //下拉列表名称
    private int inputSource;
    private int tmpInt = -1;
    private String sysParamName;
    //Added by xiekebai

    public void setSubtractDay(String subtractDay) {
        this.subtractDay = subtractDay;
    }

    public String getSubtractDay() {
        return this.subtractDay;
    }

    public void setAideDateValue(String aideDateValue) {
        this.aideDateValue = aideDateValue;
    }

    public String getAideDateValue() {
        return this.aideDateValue;
    }

    public void setNotDateValue(String notDateValue) {
        this.notDateValue = notDateValue;
    }

    public String getNotDateValue() {
        return this.notDateValue;
    }

    public void setDateValue(String dateValue) {
        this.dateValue = dateValue;
    }

    public String getDateValue() {
        return this.dateValue;
    }

    public void setTxtday(String txtday) {
        this.txtday = txtday;
    }

    public String getTxtday() {
        return this.txtday;
    }

    public void setQueryId(String val) {
        queryId = val;
    }

    public String getQueryId() {
        return queryId;
    }

    public void setParameterNumber(int val) {
        parameterNumber = val;
    }

    public int getParameterNumber() {
        return parameterNumber;
    }

    public void setParameterName(String val) {
        parameterName = val;
    }

    public String getParameterName() {
        return parameterName;
    }

    public void setParameterType(String val) {
        parameterType = val;
    }

    public String getParameterType() {
        return parameterType;
    }

    public void setHasCode(String val) {
        hasCode = val;
    }

    public String getHasCode() {
        return hasCode;
    }

    public void setCodeType(String val) {
        codeType = val;
    }

    public String getCodeType() {
        return codeType;
    }

    public void setParameterFormat(String val) {
        parameterFormat = val;
    }

    public String getParameterFormat() {
        return parameterFormat;
    }

    public void setDefaultValue(String val) {
        defaultValue = val;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setIsNeed(String val) {
        isNeed = val;
    }

    public String getIsNeed() {
        return isNeed;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getAllowSelectAll() {
        return allowSelectAll;
    }

    public void setAllowSelectAll(String allowSelectAll) {
        this.allowSelectAll = allowSelectAll;
    }

    public String getProPara() {
        return proPara;
    }

    public void setProPara(String proPara) {
        this.proPara = proPara;
    }

    public String getSubCode() {
        return subCode;
    }

    public void setSubCode(String subCode) {
        this.subCode = subCode;
    }

    public String getSubName() {
        return subName;
    }

    public int getInputSource() {
        return inputSource;
    }

    public String getSysParamName() {
        return sysParamName;
    }

    public int getTmpInt() {
        return tmpInt;
    }

    public void setSubName(String subName) {
        this.subName = subName;
    }

    public void setInputSource(int inputSource) {
        this.inputSource = inputSource;
    }

    public void setSysParamName(String sysParamName) {
        this.sysParamName = sysParamName;
    }

    public void setTmpInt(int tmpInt) {
        this.tmpInt = tmpInt;
    }

    public ActionErrors validate(ActionMapping mapping,
                                 HttpServletRequest request) {
        queryId = queryId == null ? null : queryId.trim();
        parameterName = parameterName == null ? null : parameterName.trim();
        parameterType = parameterType == null ? null : parameterType.trim();
        parameterFormat = parameterFormat == null ? null : parameterFormat.trim();
        defaultValue = defaultValue == null ? null : defaultValue.trim();
        isNeed = isNeed == null ? null : isNeed.trim();
        proPara = proPara == null ? null : proPara.trim();
        hasCode = hasCode == null ? null : hasCode.trim();
        codeType = codeType == null ? null : codeType.trim();
        sysParamName = sysParamName == null ? null : sysParamName.trim();
        ActionErrors errors = new ActionErrors();
        if (request.getParameter("action") != null) {
            if (!getProPara().equals("R")) {
                if (!StringUtility.isValidName(queryId)) {
                    errors.add(ActionErrors.GLOBAL_ERROR,
                               new ActionError("GeneralException",
                                               "<br>查询标识为空或无效"));
                }
            }
            if (parameterNumber < 1) {
                errors.add(ActionErrors.GLOBAL_ERROR,
                           new ActionError("GeneralException", "<br>参数序号必须大于零"));
            }
            if (!StringUtility.isValidName(parameterName)) {
                errors.add(ActionErrors.GLOBAL_ERROR,
                           new ActionError("GeneralException", "<br>参数名称为空或无效"));
            }
            if (inputSource == MANUALINPUT) {
                if (StringUtility.isEmpty(parameterType)) {
                    errors.add(ActionErrors.GLOBAL_ERROR,
                               new ActionError("GeneralException",
                                               "<br>参数类型不能为空"));
                }
                if (!StringUtility.isEmpty(hasCode) && hasCode.equals("1") &&
                    StringUtility.isEmpty(codeType)) {
                    errors.add(ActionErrors.GLOBAL_ERROR,
                               new ActionError("GeneralException",
                                               "<br>代码类型不能为空"));
                }
            } else if (inputSource == SYSTEMPARAM) {
                if (StringUtility.isEmpty(sysParamName)) {
                    errors.add(ActionErrors.GLOBAL_ERROR,
                               new ActionError("GeneralException",
                                               "<br>系统参数名称不能为空"));
                }
            }
        }
        if (errors.isEmpty()) {
            return null;
        } else {
            return errors;
        }
    }

    public void reset(ActionMapping mapping, HttpServletRequest request) {
        if (request.getParameter("action") == null) {
            queryId = null;
            parameterNumber = 1;
            parameterName = null;
            inputSource = 1;
            parameterType = "1";
            hasCode = "2";
            codeType = null;
            parameterFormat = null;
            defaultValue = null;
            isNeed = "2";
            proPara = "2";
            value = null;
            allowSelectAll = "2";
            tmpInt = -1;
            subCode = null;
            subName = null;
        }
    }
}

⌨️ 快捷键说明

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