创建自定义校验规则类ClientSpecialCHK
package nc.ui.bgm.test;
import nc.vo.bgm.test.TestBVO;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.trade.checkrule.ISpecialChecker;
public class ClientSpecialCHK implements ISpecialChecker {
private String m_ErrMsg;
public boolean check(AggregatedValueObject avo) {
m_ErrMsg = null;
StringBuffer strBuf = new StringBuffer();
TestVO parentVO = (TestVO) avo.getParentVO();
int iAssignType = parentVO.getPk_deptdoc().length();
if (0 == iAssignType)
if (null == parentVO.getPk_deptdoc()
|| 0 == parentVO.getPk_deptdoc().length())
strBuf.append("部门不能为空.\n");
if (strBuf!=null && strBuf.toString().length()>0){
m_ErrMsg = strBuf.toString();
return false;
}
return true;
}
public String getErrorMessage() {
if (m_ErrMsg == null)
m_ErrMsg = new String();
return m_ErrMsg;
}
}