📄 insertgatewayaction.java
字号:
/*
* 创建日期 2005-9-27
*
* TODO 要更改此生成的文件的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
package com.rainbow.mms.coremanage;
import org.apache.log4j.Logger;
import org.hibernate.Session;
import org.hibernate.Transaction;
import com.opensymphony.webwork.ServletActionContext;
import com.opensymphony.xwork.ActionSupport;
import com.rainbow.mms.common.MmsGatewayInfo;
import com.rainbow.util.tools.HibernateUtil;
/**
* @author Administrator
*
* TODO 要更改此生成的类型注释的模板,请转至 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
public class InsertGatewayAction extends ActionSupport {
private static final long serialVersionUID = 1L;
private Logger log = Logger.getLogger(InsertGatewayAction.class);
public String execute() throws Exception {
String result = ERROR;
String gateWayId = ServletActionContext.getRequest().getParameter("gateWayId");
String spId = ServletActionContext.getRequest().getParameter("spId");
String gateWayName = ServletActionContext.getRequest().getParameter("gateWayName");
gateWayName = new String(gateWayName.getBytes("iso8859-1"), "GBK");
String serviceId = ServletActionContext.getRequest().getParameter("serviceId");
String address = ServletActionContext.getRequest().getParameter("address");
address = new String(address.getBytes("iso8859-1"), "GBK");
String servicePhone = ServletActionContext.getRequest().getParameter("servicePhone");
String protocalType = ServletActionContext.getRequest().getParameter("protocalType");
String enterpiseName = ServletActionContext.getRequest().getParameter("enterpiseName");
String mmscId = ServletActionContext.getRequest().getParameter("mmscid");
enterpiseName = new String(enterpiseName.getBytes("iso8859-1"), "GBK");
String provsionUrl = ServletActionContext.getRequest().getParameter("provsionUrl");
if(provsionUrl!=null){
provsionUrl = new String(provsionUrl.getBytes("iso8859-1"), "GBK");
}
else
provsionUrl="";
try {
Session sess = HibernateUtil.currentSession();
Transaction tx = sess.beginTransaction();
MmsGatewayInfo mmsGatewayInfo = new MmsGatewayInfo();
if(gateWayId != null)
mmsGatewayInfo.setGatewayID(Integer.parseInt(gateWayId));
mmsGatewayInfo.setSpID(spId);
mmsGatewayInfo.setGatewayName(gateWayName);
mmsGatewayInfo.setServiceID(serviceId);
mmsGatewayInfo.setAddressID(address);
mmsGatewayInfo.setServicePhone(servicePhone);
mmsGatewayInfo.setProtocalType(protocalType);
mmsGatewayInfo.setEnterpiseName(enterpiseName);
mmsGatewayInfo.setMmscId(mmscId);
mmsGatewayInfo.setProvisionUrl(provsionUrl);
sess.save(mmsGatewayInfo);
tx.commit();
result = SUCCESS;
} catch (Exception e) {
e.printStackTrace();
log.error(e);
} finally {
HibernateUtil.closeSession();
}
return result;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -