Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
AddressGroupAction.java
Package: meybomailweb.rar [view]
Upload User: gtz2001
Upload Date: 2016-12-29
Package Size: 2489k
Code Size: 5k
Category:
WEB Mail
Development Platform:
Java
- package net.meybo.mail.action;
- import java.util.List;
- import net.meybo.mail.ActiveUser;
- import net.meybo.mail.client.AddressGroup;
- import net.meybo.mail.client.EmailAddress;
- import net.meybo.mail.client.EmailAddressGroup;
- import com.easyjf.util.CommUtil;
- import com.easyjf.web.ActionContext;
- import com.easyjf.web.IWebAction;
- import com.easyjf.web.Module;
- import com.easyjf.web.Page;
- import com.easyjf.web.WebForm;
- import com.easyjf.web.tools.IPageList;
- /**
- * 地址管理处理Action
- * <p>Title: </p>
- * <p>Description: 基于EasyJWeb框架,实现IWebAction接口,处理用户组的添加、删除及修改操作.</p>
- * <p>Copyright: Copyright (c) 2006</p>
- * <p>Company: 脉博软件</p>
- * @author 阚吉彬
- * @version 1.0
- */
- public class AddressGroupAction implements IWebAction {
- public Page execute(WebForm form, Module module) throws Exception {
- String method=CommUtil.null2String(form.get("easyJWebCommand"));
- ActiveUser user=(ActiveUser)ActionContext.getContext().getSession().getAttribute("user");
- if(user==null)
- {
- form.addResult("msg","您没有登录或者是超时,请重登录!");
- return new Page("noLoin","/login.ejf","html");
- }
- Page forward=null;
- if(method.equals("")||"list".equals(method))
- {
- forward=doList(form,module,user);
- }
- else if("new".equals(method))//新
- {
- EmailAddress addrM=new EmailAddress(user.getUserName(),user.getServerDomain());
- IPageList pList=addrM.list();
- pList.doList(-1,-1,"","");
- form.addResult("allAddress",EmailAddress.domList2ObjList(pList.getResult()));
- forward=module.findPage("edit");
- }
- else if("add".equals(method))//增加
- {
- forward=doAdd(form,module,user);
- }
- else if("choice".equals(method))
- {
- forward=module.findPage("choice");
- }
- else if("edit".equals(method))//编辑
- {
- forward=doEdit(form,module,user);
- }
- else if("update".equals(method))//修改
- {
- forward=doUpdate(form,module,user);
- }
- else if("del".equals(method))
- {
- forward=doDel(form,module,user);
- }
- return forward;
- }
- private Page doDel(WebForm form, Module module,ActiveUser user)
- {
- String cid=CommUtil.null2String(form.get("cid"));
- EmailAddressGroup addrM=new EmailAddressGroup(user.getUserName(),user.getServerDomain());
- AddressGroup addr=addrM.get(cid);
- System.out.println(cid);
- if(addr==null)
- {
- form.addResult("msg","找不到数据!");
- }
- if(addrM.del(addr)>0)
- {
- form.addResult("msg","信息删除成功");
- }
- else
- {
- form.addResult("msg","信息删除失败");
- }
- return doList(form,module,user);
- }
- private Page doEdit(WebForm form, Module module,ActiveUser user)
- {
- String cid=CommUtil.null2String(form.get("cid"));
- EmailAddressGroup addrM=new EmailAddressGroup(user.getUserName(),user.getServerDomain());
- AddressGroup addr=addrM.get(cid);
- //System.out.println(cid);
- if(addr==null)
- {
- form.addResult("msg","找不到数据!");
- }
- else
- CommUtil.Obj2Map(addr,form.getTextElement());
- EmailAddress addressM=new EmailAddress(user.getUserName(),user.getServerDomain());
- IPageList pList=addressM.list();
- pList.doList(-1,-1,"","");
- form.addResult("allAddress",EmailAddress.domList2ObjList(pList.getResult()));
- return module.findPage("edit");
- }
- private Page doAdd(WebForm form, Module module,ActiveUser user)
- {
- String name=CommUtil.null2String(form.get("name"));
- String emails=CommUtil.null2String(form.get("emails"));
- AddressGroup addr=new AddressGroup(name,user.getUserName()+"@"+user.getServerDomain());
- addr.setEmails(emails);
- EmailAddressGroup addrM=new EmailAddressGroup(user.getUserName(),user.getServerDomain());
- if(addrM.add(addr)>0)
- {
- form.addResult("msg","信息添加成功!");
- return doList(form,module,user);
- }
- else
- {
- form.addResult("msg","信息添加失败");
- return module.findPage("edit");
- }
- }
- private Page doUpdate(WebForm form, Module module,ActiveUser user)
- {
- String cid=CommUtil.null2String(form.get("cid"));
- String name=CommUtil.null2String(form.get("name"));
- String emails=CommUtil.null2String(form.get("emails"));
- //System.out.println(emails);
- AddressGroup addr=new AddressGroup(name,user.getUserName()+"@"+user.getServerDomain());
- addr.setEmails(emails);
- addr.setCid(cid);
- EmailAddressGroup addrM=new EmailAddressGroup(user.getUserName(),user.getServerDomain());
- if(addrM.update(addr)>0)
- {
- form.addResult("msg","信息修改成功!");
- return doList(form,module,user);
- }
- else
- {
- form.addResult("msg","信息修改失败");
- return module.findPage("edit");
- }
- }
- private Page doList(WebForm form, Module module,ActiveUser user)
- {
- int currentPage=CommUtil.null2Int(form.get("page"));
- int pageSize=CommUtil.null2Int(form.get("pageSize"));
- if(currentPage<1)currentPage=1;
- if(pageSize<1)pageSize=15;
- EmailAddressGroup addrM=new EmailAddressGroup(user.getUserName(),user.getServerDomain());
- IPageList pList=addrM.list();
- if(pList!=null){
- pList.doList(pageSize,currentPage,"","");
- List list=pList.getResult();
- form.addResult("list",EmailAddressGroup.domList2ObjList(list));
- form.addResult("pages",new Integer(pList.getPages()));
- form.addResult("rows",new Integer(pList.getRowCount()));
- form.addResult("page",new Integer(pList.getCurrentPage()));
- form.addResult("gotoPageHTML",CommUtil.showPageHtml(pList.getCurrentPage(),pList.getPages()));
- }
- return module.findPage("list");
- }
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- }
- }