package com.bussiness;
import java.text.ParseException;
import java.util.*;
import com.po.*;
import com.struts.form.*;
public class EmpBussiness implements Ibussiness {
public boolean delete(String id) {
// TODO Auto-generated method stub
EmpDAO edao=new EmpDAO();
Emp emp=edao.findById(new Integer(id));
try {
edao.delete(emp);
return true;
} catch (RuntimeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
public Vector findAll() {
// TODO Auto-generated method stub
EmpDAO edao=new EmpDAO();
List ls=edao.findAll();
Vector vc=new Vector();
for (int i = 0; i < ls.size(); i++) {
EmpForm ef=new EmpForm();
Emp emp=(Emp) ls.get(i);
//将持久化对象转换为VO(formbean对象)
ef.setEid(emp.getEid().toString());
ef.setEname(emp.getEname());
ef.setSex(emp.getSex());
ef.setAddress(emp.getAddress());
ef.setBorthday(emp.getBorthday().toLocaleString());
ef.setDepid(emp.getDep().getDepid().toString());
ef.setDepname(emp.getDep().getDepname());
//将员工的爱好对象传递给员工的formbean对象
Set emploves=emp.getEmploves();
Object[] ob=emploves.toArray();
Vector lovevc=new Vector();
String[] loveid=new String[ob.length];
for (int j = 0; j < ob.length; j++) {
Emplove el=(Emplove) ob[j];
LoveForm lf=new LoveForm();
Love lv=el.getLove();
loveid[j]=lv.getLid().toString();
lf.setLid(lv.getLid().toString());
lf.setLname(lv.getLname());
lovevc.add(lf);
}
ef.setLoveid(loveid);
ef.setLoves(lovevc);
vc.add(ef);
}
return vc;
}
public Object findById(String id) {
// TODO Auto-generated method stub
EmpDAO edao=new EmpDAO();
Emp emp=edao.findById(new Integer(id));
EmpForm ef=new EmpForm();
//将持久化对象转换为VO(formbean对象)
ef.setEid(emp.getEid().toString());
ef.setEname(emp.getEname());
ef.setSex(emp.getSex());
ef.setAddress(emp.getAddress());
ef.setBorthday(emp.getBorthday().toLocaleString());
ef.setDepid(emp.getDep().getDepid().toString());
ef.setDepname(emp.getDep().getDepname());
//将员工的爱好对象传递给员工的formbean对象
Set emploves=emp.getEmploves();
Object[] ob=emploves.toArray();
Vector lovevc=new Vector();
String[] loveid=new String[ob.length];
for (int i = 0; i < ob.length; i++) {
Emplove el=(Emplove) ob[i];
LoveForm lf=new LoveForm();
Love lv=el.getLove();
loveid[i]=lv.getLid().toString();
lf.setLid(lv.getLid().toString());
lf.setLname(lv.getLname());
lovevc.add(lf);
}
ef.setLoveid(loveid);
ef.setLoves(lovevc);
return ef;
}
public boolean save(Object ob) {
// TODO Auto-generated method stub
EmpDAO edao=new EmpDAO();
DepDAO depdao=new DepDAO();
LoveDAO lvdao=new LoveDAO();
EmpForm ef=(EmpForm) ob;
Emp emp=new Emp();
emp.setEname(ef.getEname());
emp.setSex(ef.getSex());
emp.setAddress(ef.getAddress());
try {
emp.setBorthday(java.text.DateFormat.getDateInstance().parse(ef.getBorthday()));
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
emp.setDep(depdao.findById(new Integer(ef.getDepid())));
//从界面的到的是爱好的编号数组
String loveid[]=ef.getLoveid();
Set emploves=new HashSet();
//增加数据到员工爱好表
for (int i = 0; i < loveid.length; i++) {
Love lv=lvdao.findById(new Integer(loveid[i]));
Emplove el=new Emplove();
el.setEmp(emp);
el.setLove(lv);
emploves.add(el);
}
emp.setEmploves(emploves);
try {
edao.save(emp);
return true;
} catch (RuntimeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
public boolean update(Object ob) {
// TODO Auto-generated method stub
EmpDAO edao=new EmpDAO();
DepDAO depdao=new DepDAO();
LoveDAO lvdao=new LoveDAO();
EmploveDAO eldao=new EmploveDAO();
EmpForm ef=(EmpForm) ob;
Emp emp=edao.findById(new Integer(ef.getEid()));
emp.setEname(ef.getEname());
emp.setSex(ef.getSex());
emp.setAddress(ef.getAddress());
try {
emp.setBorthday(java.text.DateFormat.getDateInstance().parse(ef.getBorthday()));
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
emp.setDep(depdao.findById(new Integer(ef.getDepid())));
//删除原有的员工爱好
Set lvset=emp.getEmploves();
Object oblv[]=lvset.toArray();
for (int i = 0; i < oblv.length; i++) {
Emplove elove=(Emplove) oblv[i];
eldao.delete(elove);
}
//从界面的到的是爱好的编号数组
String loveid[]=ef.getLoveid();
Set emploves=new HashSet();
//增加数据到员工爱好表
for (int i = 0; i < loveid.length; i++) {
Love lv=lvdao.findById(new Integer(loveid[i]));
Emplove el=new Emplove();
el.setEmp(emp);
el.setLove(lv);
emploves.add(el);
}
emp.setEmploves(emploves);
try {
edao.attachDirty(emp);
return true;
} catch (RuntimeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
采用struts+hibernate+spring 开发的ftp功能, 开发工具是MyEclipse 6.0 ,后台数据库是sq...
共138个文件
jar:41个
class:29个
java:29个
需积分: 5 67 下载量 185 浏览量
2008-12-03
12:07:22
上传
评论 1
收藏 8.76MB RAR 举报
温馨提示
采用struts+hibernate+spring 开发的ftp功能, 开发工具是MyEclipse 6.0 ,后台数据库是sql2000, sp4补丁包
资源推荐
资源详情
资源评论
收起资源包目录
采用struts+hibernate+spring 开发的ftp功能, 开发工具是MyEclipse 6.0 ,后台数据库是sql2000, sp4补丁包 (138个子文件)
EmpBussiness.class 5KB
EmpDAO.class 5KB
DepDAO.class 5KB
LoveDAO.class 5KB
EmploveDAO.class 5KB
PageDao.class 3KB
EmpForm.class 3KB
HibernateSessionFactory.class 2KB
Emp.class 2KB
ListAction.class 2KB
PageForm.class 2KB
MyDataPlugin.class 2KB
DepBussiness.class 2KB
LoveBussiness.class 2KB
UpdateAction.class 2KB
EmploveForm.class 1KB
DelAction.class 1KB
FilterChina.class 1KB
UpdateokAction.class 1KB
AddempAction.class 1KB
Love.class 1KB
Dep.class 1KB
DepForm.class 1KB
LoveForm.class 1KB
Emplove.class 1KB
EmpLoveBussiness.class 873B
BaseHibernateDAO.class 469B
Ibussiness.class 313B
IBaseHibernateDAO.class 171B
.classpath 3KB
calendar.gif 784B
close.gif 54B
hibernate3.jar 1.63MB
jgroups-2.2.8.jar 1.36MB
xerces-2.6.2.jar 966KB
jboss-jmx.jar 505KB
jboss-common.jar 499KB
struts.jar 428KB
antlr-2.7.6rc1.jar 425KB
c3p0-0.9.0.jar 421KB
proxool-0.8.3.jar 406KB
jboss-cache.jar 320KB
log4j-1.2.11.jar 305KB
msbase.jar 280KB
dom4j-1.6.1.jar 257KB
cglib-2.1.3.jar 244KB
jaxen-1.1-beta-7.jar 194KB
jboss-system.jar 193KB
commons-collections-2.1.1.jar 169KB
commons-collections.jar 160KB
concurrent-1.3.2.jar 145KB
xml-apis.jar 117KB
commons-beanutils.jar 100KB
jaas.jar 99KB
oscache-2.1.jar 97KB
commons-digester.jar 96KB
mssqlserver.jar 65KB
jakarta-oro.jar 62KB
msutil.jar 58KB
commons-lang.jar 53KB
ehcache-1.1.jar 41KB
commons-validator.jar 40KB
commons-logging-1.0.4.jar 33KB
commons-logging.jar 27KB
swarmcache-1.0rc2.jar 26KB
asm.jar 25KB
jacc-1_0-fr.jar 20KB
commons-fileupload.jar 19KB
asm-attrs.jar 16KB
connector.jar 16KB
struts-legacy.jar 9KB
jta.jar 8KB
jdbc2_0-stdext.jar 6KB
EmpBussiness.java 5KB
EmpDAO.java 4KB
DepDAO.java 4KB
LoveDAO.java 4KB
EmpForm.java 4KB
EmploveDAO.java 3KB
HibernateSessionFactory.java 3KB
PageForm.java 3KB
PageDao.java 2KB
EmploveForm.java 2KB
ListAction.java 2KB
Emp.java 2KB
DepForm.java 2KB
LoveForm.java 2KB
UpdateokAction.java 1KB
AddempAction.java 1KB
UpdateAction.java 1KB
DelAction.java 1KB
FilterChina.java 1KB
LoveBussiness.java 1015B
DepBussiness.java 935B
MyDataPlugin.java 927B
Love.java 901B
Dep.java 891B
Emplove.java 783B
EmpLoveBussiness.java 592B
BaseHibernateDAO.java 346B
共 138 条
- 1
- 2
资源评论
sldlrp7768894
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- C语言基础-C语言编程基础之Leetcode编程题解之第39题组合总和.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第38题外观数列.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第37题解数独.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第36题有效的数独.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第35题搜索插入位置.zip
- index.wxml
- C语言基础-C语言编程基础之Leetcode编程题解之第33题搜索旋转排序数组.zip
- 基于Python实现的手写数字识别系统源码.zip
- 从网页提取禁止转载的文字
- C语言基础-C语言编程基础之Leetcode编程题解之第32题最长有效括号.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功