📄 process.java
字号:
/*
* Created on 2004-4-14
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package com.cmmi2pms.pp.process;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.cmmi2pms.common.comdb.*;
/**
* <p>This is a bean,which describ a task.Using it,you can get a task informination,
* or insert a new task into the db's table.
* @author xunzy
* @version 0.01
*/
public class Process
{
// --------------------------------------------------------- Instance Variables /** taskId property */ private int taskId; /** describ property */ private String describ; /** 任务当前计划开始日期(默认为初始值) */ private String curPlanStart; /** projectId property */ private int projectId; /** 任务当前计划结束日期(默认为初始值) */ private String curPlanend; /** 任务初始计划完成日期 */ private String orgPlanend; /** 项目阶段 */ private String phase; /** 负责人id */ private int managerId; /** 任务初始计划开始日期 */ private String orgPlanStart; /** harvest property */ private String harvest; /** 项目阶段子任务 */ private String subTask; // --------------------------------------------------------- Methods
/** * Returns the taskId. * @return String */ public int getTaskId() { return taskId; } /** * Set the taskId. * @param taskId The taskId to set */ public void setTaskId(int taskId) { this.taskId = taskId; } /** * Returns the describ. * @return String */ public String getDescrib() { return describ; } /** * Set the describ. * @param describ The describ to set */ public void setDescrib(String describ) { this.describ = describ; } /** * Returns the curPlanStart. * @return String */ public String getCurPlanStart() { return curPlanStart; } /** * Set the curPlanStart. * @param curPlanStart The curPlanStart to set */ public void setCurPlanStart(String curPlanStart) { this.curPlanStart = curPlanStart; } /** * Returns the projectId. * @return String */ public int getProjectId() { return projectId; } /** * Set the projectId. * @param projectId The projectId to set */ public void setProjectId(int projectId) { this.projectId = projectId; } /** * Returns the curPlanend. * @return String */ public String getCurPlanend() { return curPlanend; } /** * Set the curPlanend. * @param curPlanend The curPlanend to set */ public void setCurPlanend(String curPlanend) { this.curPlanend = curPlanend; } /** * Returns the orgPlanend. * @return String */ public String getOrgPlanend() { return orgPlanend; } /** * Set the orgPlanend. * @param orgPlanend The orgPlanend to set */ public void setOrgPlanend(String orgPlanend) { this.orgPlanend = orgPlanend; } /** * Returns the phase. * @return String */ public String getPhase() { return phase; } /** * Set the phase. * @param phase The phase to set */ public void setPhase(String phase) { this.phase = phase; } /** * Returns the managerId. * @return int */ public int getManagerId() { return managerId; } /** * Set the managerId. * @param manager The managerId to set */ public void setManagerId(int managerId) { this.managerId = managerId; } /** * Returns the orgPlanStart. * @return String */ public String getOrgPlanStart() { return orgPlanStart; } /** * Set the orgPlanStart. * @param orgPlanStart The orgPlanStart to set */ public void setOrgPlanStart(String orgPlanStart) { this.orgPlanStart = orgPlanStart; } /** * Returns the harvest. * @return String */ public String getHarvest() { return harvest; } /** * Set the harvest. * @param harvest The harvest to set */ public void setHarvest(String harvest) { this.harvest = harvest; } /** * Returns the subTask. * @return String */ public String getSubTask() { return subTask; } /** * Set the subTask. * @param subTask The subTask to set */ public void setSubTask(String subTask) { this.subTask = subTask; }
private SqlDB dbf; private ResultSet rs;
public Process() {} private void close()
{
try
{
if(rs!=null) rs.close();
if(dbf!=null) dbf.close();
}
catch(SQLException sqle)
{
System.out.println("Close SqlDB error: "+sqle.getMessage());
}
}
public void getProcessInfo(GetProcessInfoForm info)
{
taskId=Integer.valueOf(info.getTaskId()).intValue();
System.out.println("The taskId is "+taskId);
try
{
dbf = new SqlDB();
String sql="select * from pp_proestimate where taskid="+taskId;
rs=dbf.executeQuery(sql);
System.out.println(sql);
fillField(rs);
} catch (Exception e)
{
e.printStackTrace();
}finally
{
close();
}
}
public void fillField(ResultSet rs) throws Exception
{
try
{
if(rs.next())
{
projectId=rs.getInt("projectid");
phase=rs.getString("phase");
subTask=rs.getString("subtask");
orgPlanStart=rs.getDate("orgplanstart").toString();
orgPlanend=rs.getDate("orgplanend").toString();
curPlanStart=rs.getDate("curplanstart").toString();
curPlanend=rs.getDate("curplanend").toString();
managerId=rs.getInt("manager");
harvest=rs.getString("harvest");
describ=rs.getString("describ");
}
}catch (Exception e)
{
throw new Exception("The resultSet is error: "+e.getMessage());
}
}
/**
* <p> add a new task
* @param info
*/
public void addProcess(AddProcessForm info)
{
projectId=Integer.valueOf(info.getProjectId()).intValue();
taskId=Integer.valueOf(info.getTaskId()).intValue();
phase=info.getPhase();
subTask=info.getSubTask();
orgPlanStart=info.getOrgPlanStart();
orgPlanend=info.getOrgPlanend();
curPlanStart=info.getCurPlanStart();
curPlanend=info.getCurPlanend();
managerId=Integer.valueOf(info.getManagerId()).intValue();
harvest=info.getHarvest();
describ=info.getDescrib();
try
{
dbf = new SqlDB();
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd",java.util.Locale.CHINA);
java.util.Date d = sdf.parse(orgPlanStart);
java.sql.Date startTime = new java.sql.Date(d.getTime());
d = sdf.parse(orgPlanend);
java.sql.Date endTime = new java.sql.Date(d.getTime());
d = sdf.parse(curPlanStart);
java.sql.Date curStartTime = new java.sql.Date(d.getTime());
d = sdf.parse(curPlanend);
java.sql.Date curEndTime = new java.sql.Date(d.getTime());
String sql="INSERT INTO pp_proestimate VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
System.out.println(sql);
dbf.setSql(sql);
dbf.setInt(1,projectId);
dbf.setInt(2,taskId);
dbf.setString(3,phase);
dbf.setString(4,subTask);
dbf.setDate(5,startTime);
dbf.setDate(6,endTime);
dbf.setDate(7,curStartTime);
dbf.setDate(8,curEndTime);
dbf.setInt(9,managerId);
dbf.setString(10,harvest);
dbf.setString(11,describ);
dbf.execute();
}
catch(Exception e)
{
e.printStackTrace();
}finally
{
if(dbf!=null)
try
{
dbf.close();
}
catch(SQLException se)
{
System.out.println("Close SqlDB error: "+se.getMessage());
}
}
}
/**
* <p> modify a task information
* @param info
*/
public void modProcess(AddProcessForm info)
{
projectId=Integer.valueOf(info.getProjectId()).intValue();
taskId=Integer.valueOf(info.getTaskId()).intValue();
phase=info.getPhase();
subTask=info.getSubTask();
orgPlanStart=info.getOrgPlanStart();
orgPlanend=info.getOrgPlanend();
curPlanStart=info.getCurPlanStart();
curPlanend=info.getCurPlanend();
managerId=Integer.valueOf(info.getManagerId()).intValue();
harvest=info.getHarvest();
describ=info.getDescrib();
try
{
dbf = new SqlDB();
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd",java.util.Locale.CHINA);
java.util.Date d = sdf.parse(orgPlanStart);
java.sql.Date startTime = new java.sql.Date(d.getTime());
d = sdf.parse(orgPlanend);
java.sql.Date endTime = new java.sql.Date(d.getTime());
d = sdf.parse(curPlanStart);
java.sql.Date curStartTime = new java.sql.Date(d.getTime());
d = sdf.parse(curPlanend);
java.sql.Date curEndTime = new java.sql.Date(d.getTime());
String sql="update pp_proestimate set projectId=? phase=? subtask=? orgplanstart=? orgplanend=? curplanstart=? curplanend=? manager=? harvest=? describ=? where taskid="+taskId;
System.out.println(sql);
dbf.setSql(sql);
dbf.setInt(1,projectId);
dbf.setString(2,phase);
dbf.setString(3,subTask);
dbf.setDate(4,startTime);
dbf.setDate(5,endTime);
dbf.setDate(6,curStartTime);
dbf.setDate(7,curEndTime);
dbf.setInt(8,managerId);
dbf.setString(9,harvest);
dbf.setString(10,describ);
dbf.execute();
}
catch(Exception e)
{
e.printStackTrace();
}finally
{
if(dbf!=null)
try
{
dbf.close();
}
catch(SQLException se)
{
System.out.println("Close SqlDB error: "+se.getMessage());
}
}
} public void getTaskInfo(int taskid)
{
taskId=taskid;
System.out.println("The taskId is "+taskId);
try
{
dbf = new SqlDB();
String sql="select * from pp_proestimate where taskid="+taskId;
rs=dbf.executeQuery(sql);
System.out.println(sql);
fillField(rs);
} catch (Exception e)
{
e.printStackTrace();
}finally
{
close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -