📄 altermgr.java
字号:
}finally
{
try
{
if(rs!=null) rs.close();
if(dbf!=null) dbf.close();
}
catch(SQLException se)
{
se.printStackTrace();
}
}
System.out.println("Method getAlterItemNum return "+i);
return (i);
}
/**
* 修改变更申请表,可以用于添加新的变更申请表,或是修改已有的变更申请表
* @param:alterid,变更的id,小于0时表示是一个新的变更申请,非空时是一个已有的变更申请.title,变更的标题.reason,原因.type,类型.content,内容
*/
public void modifyAppTab(int alterid,String title,String reason,String type,String content)
{
String tmp = new String("");
//int resultSize = 0;
int i;
SqlDB dbf = null;
ResultSet rs = null;
try
{
////PooledConnectionMgr.getInstance().initialize(30,ipAddr,3306,"CMMI2PM");
dbf = new SqlDB();
logger.info("modifyAppTab is invoked");
//添加新的变更申请
if (alterid < 0 )
{
logger.info("add a new alter apply");
String currentDate = getCurrentDateStr();
tmp = tmp + "insert into cm_alternation ( alterapplyid,projectid,alteritemid,level,";
tmp = tmp + "requisttype,proposerid,reason,status,appdate,approvaldate,";
tmp = tmp + "closedate,validatorid,analyserid,approverid,validatereport,";
tmp = tmp + " analysisreport,approvereport,alterreport,content) values (";
tmp = tmp + "?,?,?,\"\",?,?,?,\"applied\",?,\"\" ,\"\" ,NULL,NULL,NULL,";
tmp = tmp + " \"\",\"\" ,\"\" ,\"\" ,?)";
dbf.setSql(tmp);
dbf.setInt(1,getAlterItemNum()+1);
dbf.setString(2,prjid);
dbf.setString(3,title);
dbf.setString(4,type);
dbf.setInt(5,userid);
dbf.setString(6,reason);
dbf.setString(7,currentDate);
dbf.setString(8,content);
//logger.info("SQL statement is set");
}
//修改已有的变更申请
else
{
logger.info("update record");
tmp = tmp+"update cm_alternation set ";
tmp = tmp+"alteritemid=?, reason=?,requisttype=?,content=? where alterapplyid=?" ;
dbf.setSql(tmp);
dbf.setString(1,title);
dbf.setString(2,reason);
dbf.setString(3,type);
dbf.setString(4,content);
dbf.setInt(5,alterid);
}
dbf.execute();
logger.info("execute SQL in modifyAppTab successfully");
}
catch(SQLException se)
{
se.printStackTrace();
}catch(Exception ex)
{
ex.printStackTrace();
}finally
{
try
{
if(rs!=null) rs.close();
if(dbf!=null) dbf.close();
}
catch(SQLException se)
{
se.printStackTrace();
}
}
}
/**
*记录或修改变更分析表
*@param:String alterid, 变更标识.String anaRep,分析报告.String level,变更等级.
*/
public void modifyAnaTab(int alterid,String anaRep,String level)
{
String tmp = new String("");
//int resultSize = 0;
int i;
SqlDB dbf = null;
ResultSet rs = null;
try
{
logger.info("modifyAnaTab is invoked");
////PooledConnectionMgr.getInstance().initialize(30,ipAddr,3306,"CMMI2PM");
dbf = new SqlDB();
logger.info("DB has been initialized");
tmp = tmp+"update cm_alternation set ";
tmp = tmp+"analyserid=?, analysisreport=?,level=? where alterapplyid=?" ;
dbf.setSql(tmp);
dbf.setInt(1,userid);
dbf.setString(2,anaRep);
dbf.setString(3,level);
dbf.setInt(4,alterid);
dbf.execute();
logger.info("SQL exec successfully");
}
catch(SQLException se)
{
se.printStackTrace();
}catch(Exception ex)
{
ex.printStackTrace();
}finally
{
try
{
if(rs!=null) rs.close();
if(dbf!=null) dbf.close();
}
catch(SQLException se)
{
se.printStackTrace();
}
}
}
public void delAlter(String alterid)
{
String tmp = new String("");
//int resultSize = 0;
int i;
SqlDB dbf = null;
ResultSet rs = null;
try
{
logger.info("delAlter is invoked");
////PooledConnectionMgr.getInstance().initialize(30,ipAddr,3306,"CMMI2PM");
dbf = new SqlDB();
tmp = tmp+"delete from cm_alternation where alterapplyid=" + alterid;
dbf.setSql(tmp);
dbf.execute();
logger.info("SQL exec successfully in delAlter:" + tmp);
}
catch(SQLException se)
{
se.printStackTrace();
}catch(Exception ex)
{
ex.printStackTrace();
}finally
{
try
{
if(rs!=null) rs.close();
if(dbf!=null) dbf.close();
}
catch(SQLException se)
{
se.printStackTrace();
}
}
}
/**
*记录或修改变更审批表
*@param:int alterid,变更id.String status, 状态,为""时表示不变.String approveRep,变更审批表
*/
public void modifyApproveTab(int alterid,String status,String approveRep, String approver,String validator)
{
String tmp = new String("");
//int resultSize = 0;
int i;
SqlDB dbf = null;
ResultSet rs = null;
try
{
////PooledConnectionMgr.getInstance().initialize(30,ipAddr,3306,"CMMI2PM");
dbf = new SqlDB();
tmp = tmp+"update cm_alternation set ";
tmp = tmp+"approverid='" + userid + "',";
tmp = tmp+"approvereport='" + approveRep + "',";
tmp = tmp+"approvaldate='" + getCurrentDateStr() + "',";
tmp = tmp+"validatorid='" + validator + "',";
tmp = tmp+"status='approved'";
tmp = tmp +" where alterapplyid=" + alterid;
logger.info("SQL in modifyApproveTab:" + tmp);
dbf.setSql(tmp);
dbf.execute();
}
catch(SQLException se)
{
se.printStackTrace();
}
catch(Exception ex)
{
ex.printStackTrace();
}
finally
{
try
{
if(rs!=null) rs.close();
if(dbf!=null) dbf.close();
}
catch(SQLException se)
{
se.printStackTrace();
}
}
}
/**
* 修改或是提交软件修改报告
* @param:int alterid,变更id.String alterRep,软件修改报告
*/
public void modifyAlterRepTab(int alterid,String alterRep)
{
String tmp = new String("");
int i;
SqlDB dbf = null;
ResultSet rs = null;
try
{
////PooledConnectionMgr.getInstance().initialize(30,ipAddr,3306,"CMMI2PM");
dbf = new SqlDB();
tmp = tmp+"update cm_alternation set ";
tmp = tmp+"alterreport=?,closedate=? ,status=\"finished\" ";
tmp = tmp+"where alterapplyid = ?";
dbf.setSql(tmp);
dbf.setString(1,alterRep);
dbf.setString(2,getCurrentDateStr());
dbf.setInt(3,alterid);
dbf.execute();
}
catch(SQLException se)
{
logger.error(se.getMessage());
}
catch(Exception ex)
{
logger.error(ex.getMessage());
}
finally
{
try
{
if(rs!=null) rs.close();
if(dbf!=null) dbf.close();
}
catch(SQLException se)
{
se.printStackTrace();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -