Spring学习

#############sql-map-config.xml###############
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "http://www.ibatis.com/dtd/sql-map-config-2.dtd">

<sqlMapConfig>
<settings cacheModelsEnabled="true" enhancementEnabled="true" maxSessions="3000" maxTransactions="3000" maxRequests="3000" />
<sqlMap resource="com/tpaic/ruleengine/biz/persistence/dao/ibatis/sql/decisionRule.xml"/>
</sqlMapConfig>
###############decisionRule.xml###########
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">

<sqlMap namespace="decisionRule">

<insert id="decisionRule.insert" parameterClass="com.tpaic.ruleengine.domain.DecisionRule">
<![CDATA[
INSERT INTO T_DECISION_RULE
( CREATED_BY,
CREATED_DATE,
UPDATED_BY,
UPDATED_DATE,
RULE_ID,
RULE_DEFINE_ID,
VERSION_NO
)
VALUES
(#createdBy:VARCHAR#,
sysdate,
#updatedBy:VARCHAR#,
sysdate,
SEQ_DECISION_RULE.NEXTVAL,
#ruleDefineId:VARCHAR#,
#versionNo:VARCHAR#
)
]]>
</insert>

<select id="decisionRule.search" parameterClass="com.tpaic.ruleengine.domain.DecisionRule"
resultClass="com.tpaic.ruleengine.domain.DecisionRule">
select
RULE_ID ruleId,
RULE_DEFINE_ID ruleDefineId,
VERSION_NO versionNo
from T_DECISION_RULE c where DELETED_FLAG = '0'
<isNotEmpty prepend="and" property="ruleId">
c.RULE_ID = #ruleId#
</isNotEmpty>
<isNotEmpty prepend="and" property="ruleDefineId">
c.RULE_DEFINE_ID = #ruleDefineId#
</isNotEmpty>
<isNotEmpty prepend="and" property="versionNo">
c.VERSION_NO = #versionNo#
</isNotEmpty>
</select>

<select id="decisionRule.searchById" parameterClass="java.lang.String"
resultClass="com.tpaic.ruleengine.domain.DecisionRule">
select
RULE_ID ruleId,
RULE_DEFINE_ID ruleDefineId,
VERSION_NO versionNo
from T_DECISION_RULE c where RULE_ID = #value#
</select>

<update id="decisionRule.update" parameterClass="com.tpaic.ruleengine.domain.DecisionRule">
update T_DECISION_RULE t set
t.updated_date=sysdate,
t.updated_by=#updatedBy#,
t.VERSION_NO = #versionNo#
where RULE_ID = #ruleId#
</update>

<delete id="decisionRule.delete" parameterClass="com.tpaic.ruleengine.domain.DecisionRule">
UPDATE T_DECISION_RULE
SET DELETED_FLAG = '1',
DELETED_DATE = sysdate,
DELETED_BY =#deletedBy#
WHERE RULE_ID = #ruleId#
</delete>
</sqlMap>
########################IDecisionRuleDao.java#######################
package com.tpaic.ruleengine.biz.persistence.dao.iface;

import java.util.List;

import com.tpaic.ruleengine.domain.DecisionRule;
import com.tpaic.tpfa.app.persistence.dao.DaoException;

public interface IDecisionRuleDao {

public void insert(DecisionRule decision) throws DaoException;

public List getDecisionRuleList(DecisionRule decision) throws DaoException;

public void delete(DecisionRule decision) throws DaoException;

public DecisionRule getDecisionRuleById(String id) throws DaoException;

public void update(DecisionRule decision) throws DaoException;
}
######################DecisionRuleColumnSqlMapDao################
package com.tpaic.ruleengine.biz.persistence.dao.ibatis;

import java.util.List;

import com.tpaic.ruleengine.biz.persistence.dao.iface.IDecisionRuleColumnDao;
import com.tpaic.ruleengine.domain.DecisionRuleColumn;
import com.tpaic.tpfa.app.persistence.dao.DaoException;
import com.tpaic.tpfa.app.persistence.dao.ibatis.BaseDAO;

public class DecisionRuleColumnSqlMapDao extends BaseDAO implements IDecisionRuleColumnDao {

public void insert(DecisionRuleColumn decision) throws DaoException {
this.insert("decisionRuleColumn.insert", decision);

}

public List getDecisionRuleColumnList(
DecisionRuleColumn decision) throws DaoException {
return this.queryForList("decisionRuleColumn.search", decision);
}

public void delete(DecisionRuleColumn decision) throws DaoException {
this.delete("decisionRuleColumn.delete", decision);

}

public DecisionRuleColumn getDecisionRuleColumnById(String id)
throws DaoException {
return (DecisionRuleColumn) this.queryForObject("decisionRuleColumn.searchById", id);
}

public DecisionRuleColumn getDecisionRuleColumnByRuleDefineId(
String ruleDefineId) throws DaoException {
return (DecisionRuleColumn) this.queryForObject("decisionRuleColumn.searchByRuleDefineId", ruleDefineId);
}


}
##########################IDecisionRuleBoService.java#################
package com.tpaic.ruleengine.biz.bo;

import java.util.List;

import com.tpaic.ruleengine.domain.DecisionRule;
import com.tpaic.tpfa.app.biz.service.BusinessServiceException;

public interface IDecisionRuleBoService {

public void insert(DecisionRule decision) throws BusinessServiceException;

public List getDecisionRuleList(DecisionRule decision) throws BusinessServiceException;

public void delete(DecisionRule decision) throws BusinessServiceException;

public DecisionRule getDecisionRuleById(String id) throws BusinessServiceException;

public void update(DecisionRule decision) throws BusinessServiceException;
}
######################DecisionRuleBoServiceImp.java##########
package com.tpaic.ruleengine.biz.bo.impl;
import java.util.List;

import com.tpaic.ruleengine.biz.bo.IDecisionRuleBoService;
import com.tpaic.ruleengine.biz.persistence.dao.iface.IDecisionRuleDao;
import com.tpaic.ruleengine.domain.DecisionRule;
import com.tpaic.tpfa.app.biz.service.BusinessServiceException;
import com.tpaic.tpfa.app.persistence.dao.DaoException;

public class DecisionRuleBoServiceImp implements IDecisionRuleBoService {

private IDecisionRuleDao decisionRuleDao;

public void setDecisionRuleDao(IDecisionRuleDao decisionRuleDao) {
this.decisionRuleDao = decisionRuleDao;
}

public void insert(DecisionRule decision)
throws BusinessServiceException {
try {
decisionRuleDao.insert(decision);
} catch (DaoException daoe) {
throw new BusinessServiceException(daoe);
}
}

public List getDecisionRuleList(DecisionRule decision) throws BusinessServiceException {
try {
return decisionRuleDao.getDecisionRuleList(decision);
} catch (DaoException daoe) {
throw new BusinessServiceException(daoe);
}
}
public void delete(DecisionRule decision)
throws BusinessServiceException {
try {
decisionRuleDao.delete(decision);
} catch (DaoException daoe) {
throw new BusinessServiceException(daoe);
}
}

public DecisionRule getDecisionRuleById(String id)
throws BusinessServiceException {
try {
return decisionRuleDao.getDecisionRuleById(id);
} catch (DaoException daoe) {
throw new BusinessServiceException(daoe);
}
}

public void update(DecisionRule decision) throws BusinessServiceException {
try {
decisionRuleDao.update(decision);
} catch (DaoException daoe) {
throw new BusinessServiceException(daoe);
}
}

}
#####################IDecisionRuleService.java##############
package com.tpaic.ruleengine.biz.service;

import java.util.List;

import com.tpaic.ruleengine.domain.DecisionRule;
import com.tpaic.tpfa.app.biz.service.BusinessServiceException;

public interface IDecisionRuleService {

public void insert(DecisionRule decision) throws BusinessServiceException;

public List getDecisionRuleList(DecisionRule decision) throws BusinessServiceException;

public DecisionRule getDecisionRuleById(String id) throws BusinessServiceException;

public void delete(DecisionRule[] decisions) throws BusinessServiceException;

public void update(DecisionRule decision) throws BusinessServiceException;


}
#########################DecisionRuleServiceImp.java###############
package com.tpaic.ruleengine.biz.service.impl;


import java.util.List;

import com.tpaic.ruleengine.biz.bo.IDecisionColumnDefineBoService;
import com.tpaic.ruleengine.biz.bo.IDecisionRuleBoService;
import com.tpaic.ruleengine.biz.bo.IDecisionRuleColumnBoService;
import com.tpaic.ruleengine.biz.bo.IDecisionRuleDefineBoService;
import com.tpaic.ruleengine.biz.bo.IDecisionTableBoService;
import com.tpaic.ruleengine.biz.service.IDecisionRuleService;
import com.tpaic.ruleengine.domain.DecisionColumnDefine;
import com.tpaic.ruleengine.domain.DecisionRule;
import com.tpaic.ruleengine.domain.DecisionRuleColumn;
import com.tpaic.ruleengine.domain.DecisionRuleDefine;
import com.tpaic.ruleengine.domain.DecisionTable;
import com.tpaic.tpfa.app.biz.service.BusinessServiceException;
import com.tpaic.tpfa.app.persistence.dao.DaoException;

public class DecisionRuleServiceImp implements IDecisionRuleService {

private IDecisionRuleBoService decisionRuleBo;
private IDecisionTableBoService decisionTableBo;
private IDecisionRuleDefineBoService decisionRuleDefineBo;
private IDecisionRuleColumnBoService decisionRuleColumnBo;
private IDecisionColumnDefineBoService decisionColumnDefineBo;

public void setDecisionRuleBo(IDecisionRuleBoService decisionRuleBo) {
this.decisionRuleBo = decisionRuleBo;
}

public void setDecisionColumnDefineBo(
IDecisionColumnDefineBoService decisionColumnDefineBo) {
this.decisionColumnDefineBo = decisionColumnDefineBo;
}

public void setDecisionRuleColumnBo(
IDecisionRuleColumnBoService decisionRuleColumnBo) {
this.decisionRuleColumnBo = decisionRuleColumnBo;
}

public void setDecisionRuleDefineBo(
IDecisionRuleDefineBoService decisionRuleDefineBo) {
this.decisionRuleDefineBo = decisionRuleDefineBo;
}

public IDecisionTableBoService getDecisionTableBo() {
return decisionTableBo;
}

public void setDecisionTableBo(IDecisionTableBoService decisionTableBo) {
this.decisionTableBo = decisionTableBo;
}

public DecisionRule getDRuleAndRelationById(String ruleId) {
try {
DecisionRule dRule = decisionRuleBo.getDecisionRuleById(ruleId);
//决策表对象
DecisionTable dTable = decisionTableBo.getDecisionTableByRuleId(ruleId);
dRule.setTable(dTable);
//规则定义对象
DecisionRuleDefine dRuleDefine = decisionRuleDefineBo
.getDecisionRuleDefineById(dRule.getRuleDefineId());
dRule.setRuleDefine(dRuleDefine);
//关联表对象
// DecisionRuleColumn dRuleColumn = decisionRuleColumnBo
// .getDecisionRuleColumnByRuleDefineId(dRule.getRuleDefineId());
//列对象列表
List dColumnDefineList = decisionColumnDefineBo
.getDColumnDefineListByRuleDefineId(dRule.getRuleDefineId());
dRuleDefine.setColumnDefines(dColumnDefineList);
return dRule;
} catch (DaoException daoe) {
throw new BusinessServiceException(daoe);
}
}

public void insert(DecisionRule decision) throws BusinessServiceException{
try {
decisionRuleBo.insert(decision);
} catch (DaoException daoe) {
throw new BusinessServiceException(daoe);
}
}

public List getDecisionRuleList(DecisionRule decision) throws BusinessServiceException {
try {
return decisionRuleBo.getDecisionRuleList(decision);
} catch (DaoException daoe) {
throw new BusinessServiceException(daoe);
}
}

public void delete(DecisionRule[] decisions) throws BusinessServiceException {
try {
for(int i=0; i<decisions.length; i++) {
decisionRuleBo.delete(decisions[i]);
}
} catch (DaoException daoe) {
throw new BusinessServiceException(daoe);
}
}

public DecisionRule getDecisionRuleById(String id)
throws BusinessServiceException {
try {
return decisionRuleBo.getDecisionRuleById(id);
} catch (DaoException daoe) {
throw new BusinessServiceException(daoe);
}
}

public void update(DecisionRule decision) throws BusinessServiceException {
try {
decisionRuleBo.update(decision);
} catch (DaoException daoe) {
throw new BusinessServiceException(daoe);
}
}
}
###########################dao-context.xml##############
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
<bean id="decisionRuleDao" class="com.tpaic.ruleengine.biz.persistence.dao.ibatis.DecisionRuleSqlMapDao">
<property name="sqlMapClient" ref="sqlMapClient" />
</bean>
</beans>
########################service-context.xml################
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

<!-- service start -->
<bean id="decisionRuleService" class="com.tpaic.ruleengine.biz.service.impl.DecisionRuleServiceImp" lazy-init="true">
<property name="decisionRuleBo" ref="decisionRuleBo" />
<property name="decisionTableBo" ref="decisionTableBo" />
<property name="decisionRuleDefineBo" ref="decisionRuleDefineBo" />
<property name="decisionRuleColumnBo" ref="decisionRuleColumnBo" />
<property name="decisionColumnDefineBo" ref="decisionColumnDefineBo" />
</bean>
<!-- service end -->
<!-- bo start -->
<bean id="decisionRuleBo" class="com.tpaic.ruleengine.biz.bo.impl.DecisionRuleBoServiceImp">
<property name="decisionRuleDao" ref="decisionRuleDao" />
</bean>
<!-- bo end -->
<!-- transaction start -->
<bean id="decisionRuleServiceTransaction" parent="baseTransactionProxy">
<property name="target" ref="decisionRuleService" />
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED,-BusinessServiceException</prop>
</props>
</property>
</bean>
</beans>
###################decisionRule_add.jsp#############
<%@ page contentType="text/html;charset=GBK"%>
<%@include file="../common/tag_include.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>
新增规则实例
</title>
<link rel="stylesheet" href="<%=request.getContextPath()%>/js/default.css" type="text/css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/js/menu.css" type="text/css">
<script language="javascript" src="<%=request.getContextPath()%>/js/global.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/tooltip.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/common.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/xmlcommon.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/checkfield.js"></script>
</head>
<body topmargin="0" leftmargin="0">
<form name="form1" method="post" action="decisionRuleAdd.do">
<table width="100%" border="0" cellspacing="1" cellpadding="2" align="center" class="etable">
<input type="hidden" name="ruleId" value="<c:out value="${decisionRule.ruleId}"/>" />
<tr align="center">
<td class="content" colspan="4">
<b>
新增规则实例
</b>
</td>
</tr>

<tr>
<td align="right" width="15%">版本号</td>
<td width="35%" colspan="3">
<input type="text" name='versionNo' value=''>
</td>
</tr>

<tr>
<td align="center" colspan="4">
<input name="btnSave" value=" 保 存 " type="button" class="tpbutton" οnclick="javasript:addObject();">
</td>
</tr>
</table>
</form>
</body>
</html>

<script languge="javascript">

function addObject(){
var versionNo = form1.versionNo.value;
if(versionNo.trim()==""){
alert("版本号不能为空");
form1.versionNo.focus();
return;
}
form1.submit();
form1.btnSave.disabled=true;
}

function successCallback(){
searchForm();
}

</script>
#######################decisionRule_edit.jsp#############
<%@ page contentType="text/html;charset=GBK"%>
<%@include file="../common/tag_include.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>
修改规则实例
</title>
<link rel="stylesheet" href="<%=request.getContextPath()%>/js/default.css" type="text/css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/js/menu.css" type="text/css">
<script language="javascript" src="<%=request.getContextPath()%>/js/global.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/tooltip.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/common.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/xmlcommon.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/checkfield.js"></script>
</head>
<body topmargin="0" leftmargin="0">
<form name="form1" method="post" action="decisionRuleUpdate.do">
<table width="100%" border="0" cellspacing="1" cellpadding="2" align="center" class="etable">
<input type="hidden" name="ruleId" value="<c:out value="${decisionRule.ruleId}"/>" />
<tr align="center">
<td class="content" colspan="4">
<b>
修改规则实例
</b>
</td>
</tr>

<tr>
<td align="right" width="15%">版本号</td>
<td width="35%" colspan="3">
<input type="text" name='versionNo' value='<c:out value="${decisionRule.versionNo}"/>'>
</td>
</tr>


<tr>
<td align="center" colspan="4">
<input name="btnSave" value=" 保 存 " type="button" class="tpbutton" οnclick="javasript:addObject();">
</td>
</tr>
</table>
</form>
</body>
</html>

<script languge="javascript">

function addObject(){
var versionNo = form1.versionNo.value;
if(versionNo.trim()==""){
alert("版本不能为空");
form1.versionNo.focus();
return;
}
form1.submit();
form1.btnSave.disabled=true;
}

function successCallback(){
searchForm();
}

</script>
#############################decisionRule_search.jsp###############
<%@ page contentType="text/html;charset=GBK"%>
<%@include file="../common/tag_include.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>规则实例管理</title>
<link rel="stylesheet" href="<%=request.getContextPath()%>/js/default.css" type="text/css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/js/menu.css" type="text/css">
<script language="javascript" src="<%=request.getContextPath()%>/js/global.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/tooltip.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/common.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/xmlcommon.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/checkfield.js"></script>
</head>
<body topmargin="0" leftmargin="0">
<form name="form1" method="post" action="decisionRuleSearch.do">
<table width="100%" border="0" cellspacing="1" cellpadding="2" align="center" class="etable">
<TR align="center">
<TD class="content" colspan="4">
<b> 规则实例管理 </b>
</TD>
</TR>
<TR>
<TD align="right" width="15%">
规则ID
</TD>
<TD width="35%">
<input type="text" name="ruleId" value="<c:out value="${decisionRuleSearch.ruleId}"/>" />
</TD>
<TD align="right" width="15%">
规则定义
</TD>
<TD width="35%">
<input type="text" name="ruleDefineId" value="<c:out value="${decisionRuleSearch.ruleDefineId}"/>" />
</TD>
</TR>
<TR>
<TD align="right" width="15%">
版本号
</TD>
<TD width="35%" colspan="3">
<input type="text" name="versionNo" value="<c:out value="${decisionRuleSearch.versionNo}"/>" />
</TD>
</TR>
<TR align="center">
<TD colspan="4">
<input type="button" class="tpbutton" value=" 查 询 " onClick="searchForm()">
 
<input type="button" class="tpbutton" value=" 新 增 " onClick="addObject();" />
 
</TD>
</TR>
</table>

<table width="100%" border="0" cellspacing="1" cellpadding="2" align="center" class="etable">
<tr align="center">
<td class="content" colspan="15">
<b> 信息列表 </b>
</td>
</tr>
<TR>
<TD align="center">
<B> 选 择 </B>
</TD>
<TD align="center">
<B> 规则ID </B>
</TD>
<TD align="center">
<B> 规则定义</B>
</TD>
<TD align="center">
<B> 版本号 </B>
</TD>
</TR>
<c:forEach var="decisionRule" items="${decisionRuleList}" varStatus="status">
<TR>
<TD align="center">
<input type='checkbox' name='objectId' value="<c:out value="${decisionRule.ruleId}"/>" />
</TD>
<TD align="center">
<a href=javascript:viewDetail("<c:out value="${decisionRule.ruleId}" />");> <font color="blue"><c:out value="${decisionRule.ruleId}" /></font> </a>
</TD>

<TD align="center">
<c:out value="${decisionRule.ruleDefineId}" />
</TD>
<TD align="center">
<c:out value="${decisionRule.versionNo}" />
</TD>
</TR>
</c:forEach>
<TR>
<TD colspan="15">
<input type="checkbox" name="cbSelectAll" id="cbSelectAll" class="checkall" onClick="selectAll_TP(form1,this);">
<label for="cbSelectAll">
全选/取消 
</label>
</TD>
</TR>
<TR>
<TD align="center" colspan="15">
<input type="button" class="tpbutton" name="btnEdit" value=" 修 改 " onClick="editObject();" />
 
<input type="button" class="tpbutton" name="btnDelete" value=" 删 除 " onClick="deleteObject();" />
 
</TD>
</TR>
</form>
</table>
<jsp:include page="../common/pagdisp_model.jsp">
<jsp:param name="pageId" value="QueryDecisionRuleList" />
<jsp:param name="viewName" value="/ruleengine/decisionRule_search" />
<jsp:param name="modelName" value="decisionRuleList" />
<jsp:param name="formName" value="form1" />
</jsp:include>
<iFrame id="hiddenFrame" name="hiddenFrame" src="about:blank" width="100%" height=0 marginwidth=″0″ marginheight=″0″ frameborder="0" scrolling="no" space="0" vspace="0"></iframe>
</body>
</html>

<script languge="javascript">

function searchForm(){
form1.target="_self";
form1.action="decisionRuleSearch.do";
form1.submit();
}

function selectAll_TP(formObj,obj){
var inputArray = formObj.elements;
for(var i = 0; i < inputArray.length; i++){
try{
if(inputArray[i].type == "checkbox"){
inputArray[i].checked = obj.checked;
}
}catch(e){
}
}
}

function viewDetail(objectId){
var url = "decisionRuleView.do?ruleId="+objectId;
window.open(url,'viewObject',"scrollbars=yes,status=no,width=800,height=600");
}

function addObject(){
var url = "decisionRuleAddInput.do";
window.open(url,'createObject',"scrollbars=yes,status=no,width=800,height=600");
}

function addBatchObject(){
var url = "decisionRuleBatchAddInput.do";
window.open(url,'createObject',"scrollbars=yes,status=no,width=800,height=600");
}

function editObject(){
var raAll = document.getElementsByName('objectId');
if (raAll.length<1){
alert("请先选中!");
return;
}
var objectId = "";
var k=-1;
for (var i=0; i<raAll.length; i++) {
if(raAll[i].checked == true ){
k++;
objectId = raAll[i].value;
}
}
if(k<0){
alert("请先选中!");
return;
}else if(k>0){
alert("只能选中一项!");
return;
}
var url = "decisionRuleUpdateInput.do?ruleId="+objectId;
window.open(url,'editObject',"scrollbars=yes,status=no,width=800,height=600");
}

function deleteObject(){
var raAll = document.getElementsByName('objectId');
if (raAll.length<1){
alert("请先选中!");
return;
}
var objectId = "";
var k=-1;
for (var i=0; i<raAll.length; i++) {
if(raAll[i].checked == true ){
k++;
objectId = raAll[i].value;
}
}
if(k<0){
alert("请先选中!");
return;
}
form1.target="hiddenFrame";
form1.action="decisionRuleDelete.do";
form1.submit();
form1.btnDelete.disabled=true;
}

function successCallback(){
searchForm();
}

</script>
#######################decisionRule_view.jsp#############
<%@ page contentType="text/html;charset=GBK"%>
<%@include file="../common/tag_include.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>
查看规则实例
</title>
<link rel="stylesheet" href="<%=request.getContextPath()%>/js/default.css" type="text/css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/js/menu.css" type="text/css">
<script language="javascript" src="<%=request.getContextPath()%>/js/global.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/tooltip.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/common.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/xmlcommon.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/checkfield.js"></script>
</head>
<body topmargin="0" leftmargin="0">
<form name="form1" method="post" action="">
<table width="100%" border="0" cellspacing="1" cellpadding="2" align="center" class="etable">
<tr align="center">
<td class="content" colspan="4">
<b>
规则实例信息
</b>
</td>
</tr>
<tr>
<td align="right" width="15%">规则ID</td>
<td width="35%">
<c:out value="${decisionRule.ruleId}"/>
</td>
<td align="right" width="15%">规则定义流水号</td>
<td width="35%">
<c:out value="${decisionRule.ruleDefineId}"/>
</td>
</tr>
<tr>
<td align="right" width="15%">版本号</td>
<td width="35%" colspan="3">
<c:out value="${decisionRule.versionNo}"/>
</td>
</tr>
</table>
</form>
</body>
</html>

</script>
#########################tpaic-ruleengine-servlet.xml############
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:ruleengine-jdbc.properties</value>
<value>classpath:ruleengine-jndi.properties</value>
</list>
</property>
</bean>

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>


<bean id="sessionInterceptor" class="com.tpaic.um.presentation.interceptor.SessionInterceptor">
<property name="loginController" ref="loginController" />
</bean>

<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize">
<value>5000000</value>
</property>
<property name="maxInMemorySize">
<value>4096</value>
</property>
<property name="defaultEncoding">
<value>GBK</value>
</property>
</bean>

<bean id="defaultHandlerMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
<property name="interceptors">
<list>
<ref bean="sessionInterceptor" />
</list>
</property>
</bean>

<bean name="dispatchService" class="com.tpaic.tpfa.app.biz.dispatch.impl.ServiceControllerLocalImpl">
<property name="beanFactoryLocator" value="com/tpaic/ruleengine/biz/beanRefContext.xml" />
<property name="beanFactoryLocatorKey" value="com.tpaic.ruleengine.biz" />
</bean>

<bean name="loginController" class="com.tpaic.ruleengine.presentation.controller.LoginController">
<property name="dispatch" ref="dispatchService" />
</bean>
<bean name="/prelogin.do" class="com.tpaic.um.presentation.controller.PreloginController">
<property name="dispatch" ref="dispatchService" />
</bean>
<bean name="/index.do" class="org.springframework.web.servlet.mvc.ParameterizableViewController">
<property name="viewName" value="index" />
</bean>
<bean name="/menu.do" class="org.springframework.web.servlet.mvc.ParameterizableViewController">
<property name="viewName" value="menu" />
</bean>
<bean name="/login_info.do" class="com.tpaic.ruleengine.presentation.controller.LoginInfoController">
<property name="dispatch" ref="dispatchService" />
<property name="formView" value="login_info" />
</bean>
<bean name="/head.do" class="org.springframework.web.servlet.mvc.ParameterizableViewController">
<property name="viewName" value="head" />
</bean>

<bean name="/**/pagination.do" class="com.tpaic.tpfa.app.web.PaginationController"></bean>
<bean name="aggregatedSearchSupport" class="com.tpaic.ruleengine.util.AggregatedSearchSupport">
<property name="dispatch" ref="dispatchService" />
</bean>
<!-- 规则定义 -->
<bean name="/decisionRuleDefineAddInput.do" class="com.tpaic.ruleengine.presentation.controller.DecisionRuleDefineAddInputController">
<property name="dispatch" ref="dispatchService" />
<property name="formView" value="ruleengine/decisionRuleDefine_add" />
</bean>
<bean name="/decisionRuleDefineAdd.do" class="com.tpaic.ruleengine.presentation.controller.DecisionRuleDefineAddController">
<property name="dispatch" ref="dispatchService" />
<property name="formView" value="common/successCallback" />
</bean>
<bean name="/decisionRuleDefineSearch.do" class="com.tpaic.ruleengine.presentation.controller.DecisionRuleDefineSearchController">
<property name="dispatch" ref="dispatchService" />
<property name="formView" value="ruleengine/decisionRuleDefine_search" />
</bean>
<bean name="/decisionRuleDefineUpdateInput.do" class="com.tpaic.ruleengine.presentation.controller.DecisionRuleDefineUpdateInputController">
<property name="dispatch" ref="dispatchService" />
<property name="formView" value="ruleengine/decisionRuleDefine_edit" />
</bean>
<bean name="/decisionRuleDefineUpdate.do" class="com.tpaic.ruleengine.presentation.controller.DecisionRuleDefineUpdateController">
<property name="dispatch" ref="dispatchService" />
<property name="formView" value="common/successCallback" />
</bean>
<bean name="/decisionRuleDefineDelete.do" class="com.tpaic.ruleengine.presentation.controller.DecisionRuleDefineDeleteController">
<property name="dispatch" ref="dispatchService" />
<property name="formView" value="common/successCallback" />
</bean>

</beans>
########################DecisionRuleSearchController.java#############
package com.tpaic.ruleengine.presentation.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;

import com.tpaic.ruleengine.domain.DecisionRule;
import com.tpaic.ruleengine.util.ServiceRequestID;
import com.tpaic.ruleengine.util.Constants;
import com.tpaic.tpfa.app.dto.ActionDTO;
import com.tpaic.tpfa.app.util.StringUtil;
import com.tpaic.tpfa.app.web.AbstractViewController;
import com.tpaic.tpfa.app.web.PaginationController;
import com.tpaic.tpfa.app.web.util.DTOBuilder;

public class DecisionRuleSearchController extends AbstractViewController {

protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response) throws Exception {
Map model = new HashMap();
try {
DecisionRule rule = this.getObjectForSearch(request);
model.put("decisionRuleSearch", rule);
ActionDTO actionDTO = new ActionDTO();
actionDTO.setOperationType(Constants.ACTION_METHOD_SEARCH);
actionDTO.setObject(rule);

List decisionRuleList = (List) dispatch.dispatchRequest(actionDTO,
ServiceRequestID.DECISION_RULE_ACTION);
model.put("decisionRuleList", decisionRuleList);
model = PaginationController.page(request, "QueryDecisionRuleList", model,
"decisionRuleList");
return new ModelAndView(this.getFormView(), model);
} catch (Exception e) {
e.printStackTrace();
model = new HashMap();
model.put(Constants.ERROR_MSG, e.getMessage());
model.put(Constants.ERROR_EXCEPTION, StringUtil
.getThrowableString(e));
return new ModelAndView(Constants.ERROR_PAGE, model);
}
}
private DecisionRule getObjectForSearch(HttpServletRequest request) throws Exception {
DecisionRule obj = new DecisionRule();
DTOBuilder.setDTOValue(request, obj);
return obj;
}

}
########################DecisionRuleUpdateController.java############
package com.tpaic.ruleengine.presentation.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;

import com.tpaic.ruleengine.domain.DecisionRule;
import com.tpaic.ruleengine.util.ServiceRequestID;
import com.tpaic.ruleengine.util.Constants;
import com.tpaic.tpfa.app.dto.ActionDTO;
import com.tpaic.tpfa.app.util.StringUtil;
import com.tpaic.tpfa.app.web.AbstractViewController;
import com.tpaic.tpfa.app.web.util.DTOBuilder;

public class DecisionRuleUpdateController extends AbstractViewController {

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map model = new HashMap();
try {
DecisionRule obj = getObjectByInput(request);
obj.setUpdatedBy("admin");
ActionDTO actionDTO = new ActionDTO();
actionDTO.setOperationType(Constants.ACTION_METHOD_UPDATE);
actionDTO.setObject(obj);
dispatch.dispatchRequest(actionDTO, ServiceRequestID.DECISION_RULE_ACTION);

return new ModelAndView(this.getFormView(), model);
} catch (Exception e) {
e.printStackTrace();
model = new HashMap();
model.put(Constants.ERROR_MSG, e.getMessage());
model.put(Constants.ERROR_EXCEPTION, StringUtil.getThrowableString(e));
return new ModelAndView(Constants.ERROR_PAGE, model);
}
}

private DecisionRule getObjectByInput(HttpServletRequest request)throws Exception{
DecisionRule obj = new DecisionRule();
DTOBuilder.setDTOValue(request, obj);
return obj;
}

}

###########################DecisionRuleUpdateInputController.java############
package com.tpaic.ruleengine.presentation.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;

import com.tpaic.ruleengine.domain.DecisionRule;
import com.tpaic.ruleengine.util.ServiceRequestID;
import com.tpaic.ruleengine.util.Constants;
import com.tpaic.tpfa.app.dto.ActionDTO;
import com.tpaic.tpfa.app.util.StringUtil;
import com.tpaic.tpfa.app.web.AbstractViewController;
import com.tpaic.tpfa.app.web.exception.WebException;

public class DecisionRuleUpdateInputController extends AbstractViewController {

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map model = new HashMap();
try {
String objectId = request.getParameter("ruleId");
objectId = objectId==null||objectId.trim().equals("")?null:objectId.trim();
if(objectId==null){
throw new WebException("无效编号");
}
ActionDTO actionDTO = new ActionDTO();
actionDTO.setOperationType(Constants.ACTION_METHOD_VIEW);
actionDTO.setObject(objectId);
DecisionRule obj = (DecisionRule)dispatch.dispatchRequest(actionDTO, ServiceRequestID.DECISION_RULE_ACTION);

model.put("decisionRule",obj);

return new ModelAndView(this.getFormView(), model);
} catch (Exception e) {
e.printStackTrace();
model = new HashMap();
model.put(Constants.ERROR_MSG, e.getMessage());
model.put(Constants.ERROR_EXCEPTION, StringUtil.getThrowableString(e));
return new ModelAndView(Constants.ERROR_PAGE, model);
}
}

}
#######################DecisionRuleViewController.java#########
package com.tpaic.ruleengine.presentation.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;

import com.tpaic.ruleengine.domain.DecisionRule;
import com.tpaic.ruleengine.util.ServiceRequestID;
import com.tpaic.ruleengine.util.Constants;
import com.tpaic.tpfa.app.dto.ActionDTO;
import com.tpaic.tpfa.app.util.StringUtil;
import com.tpaic.tpfa.app.web.AbstractViewController;
import com.tpaic.tpfa.app.web.exception.WebException;

public class DecisionRuleViewController extends AbstractViewController {

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map model = new HashMap();
try {
String objectId = request.getParameter("ruleId");
objectId = objectId==null||objectId.trim().equals("")?null:objectId.trim();
if(objectId==null){
throw new WebException("无效编号");
}
ActionDTO actionDTO = new ActionDTO();
actionDTO.setOperationType(Constants.ACTION_METHOD_VIEW);
actionDTO.setObject(objectId);
DecisionRule obj = (DecisionRule)dispatch.dispatchRequest(actionDTO, ServiceRequestID.DECISION_RULE_ACTION);
model.put("decisionRule",obj);
return new ModelAndView(this.getFormView(), model);
} catch (Exception e) {
e.printStackTrace();
model = new HashMap();
model.put(Constants.ERROR_MSG, e.getMessage());
model.put(Constants.ERROR_EXCEPTION, StringUtil.getThrowableString(e));
return new ModelAndView(Constants.ERROR_PAGE, model);
}
}

}

#########################end#############
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值