📄 farchive.java
字号:
//package com.stsc.archive.xml;
package com.stsc.archive.backup;
/*
与数据库中表fArchive相对应的bean
*/
import java.io.IOException;
import java.util.Hashtable;
import java.util.Locale;
import java.util.Properties;
import java.util.Date;
import com.stsc.util.STPoolDataSet;
import com.stsc.util.STResultSet;
import com.stsc.archive.manage.Constants;
import com.stsc.archive.backup.CopyFile;
public class fArchive {
// --------------------------------------------------- Instance Variables
//定义时间类型,取出当前系统时间
//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//String todayStr = sdf.format(new java.util.Date());
private int serialno = 0;
private int status = 0; //add
private String deleted = ""; //add
private int repflag = 0; //add
private String archivetype = "";
private String filetype = "";
private String title = "";
private String literaturetype = "";
private String titleremark = "";
private String fileno = "";
private Date filedate = null;
private String keyword = "";
private String code = "";
private String category = "";
private int pagenumber = 0;
private String duty = "";
private String otherduty = "";
private String electronicfilename = "";
private String attachmenttitle = "";
private String memo = "";
private int copys = 0;
private int lendnum = 0;
private String securityclass = "";
private int securityterm = 0;
private Date decryptiondate = null;
// private int retentionperiod = 0;
private String retentionperiod = ""; //6.3 modify
private Date archivedate = null;
private Date destroydate = null;
private String archivalcode = "";
private String dossierno = ""; //add
private String archiveno = "";
private String unitno = ""; //add
private String filingtrace = "";
private String handover = "";
private String filingscripts = "";
// private Date reappraisedates = "";
private String reappraisedates = ""; //modify
private String annotation = "";
private String abstractmsg = "";
private String suggest = "";
private String recordtransfer = "";
private String volumnNo = ""; //add
private String attachmentPath = ""; //5.23 add
private String flowNo = ""; //6.3 add,流水号
private String backupAttachmentPath = ""; //备份后的附件路径,5.26add,仅保存在xml中,数据库中没有该项
/**
从数据库中读取数据(根据流水号)
*/
public boolean getDataFromDb(int serialno)
{
Properties dbBase = new Properties();
dbBase.setProperty("dsJndiName", Constants.ARCHIVE_DBSOURCE_KEY);
STPoolDataSet data = new STPoolDataSet();
String sql = "SELECT * FROM fArchive WHERE SerialNo=" + serialno;
STResultSet rs = data.getSTResult(sql, dbBase);
if (rs!=null && rs.next())
{
setSerialno(rs.getInt("SerialNo"));System.out.println("aaaaaaaaa");
setStatus(rs.getInt("Status"));System.out.println("ca");
setDeleted(rs.getString("Deleted"));
setRepflag(rs.getInt("RepFlag"));
setArchivetype(rs.getString("ArchiveType"));
setFiletype(rs.getString("FileType"));
setTitle(rs.getString("Title"));
setLiteraturetype(rs.getString("LiteratureType"));
setTitleremark(rs.getString("TitleRemark"));
setFileno(rs.getString("FileNo"));
setFiledate(rs.getDate("FileDate"));
setKeyword(rs.getString("KeyWord"));
setCode(rs.getString("Code"));
setCategory(rs.getString("Category"));
setPagenumber(rs.getInt("PageNumber"));
setDuty(rs.getString("Duty"));
setOtherduty(rs.getString("OtherDuty"));
setElectronicfilename(rs.getString("ElectronicFileName"));
setAttachmenttitle(rs.getString("AttachmentTitle"));
setMemo(rs.getString("Memo"));
setCopys(rs.getInt("Copys"));
setLendnum(rs.getInt("LendNum"));
setSecurityclass(rs.getString("SecurityClass"));
setSecurityterm(rs.getInt("SecurityTerm"));
setDecryptiondate(rs.getDate("DecryptionDate"));
setRetentionperiod(rs.getString("RetentionPeriod")); //6.3 modify int to string
setArchivedate(rs.getDate("ArchiveDate"));
setDestroydate(rs.getDate("DestroyDate"));System.out.println("bbbbbbbbbb");
setArchivalcode(rs.getString("ArchivalCode"));
setDossierno(rs.getString("DossierNo"));
setArchiveno(rs.getString("ArchiveNo"));
setUnitno(rs.getString("UnitNo"));
setFilingtrace(rs.getString("FilingTrace"));
setHandover(rs.getString("HandOver"));
setFilingscripts(rs.getString("FilingScripts"));
setReappraisedates(rs.getString("ReAppraiseDates"));System.out.println("aaaaaaaaa");
setAnnotation(rs.getString("Annotation"));
setAbstractmsg(rs.getString("Abstract"));
setSuggest(rs.getString("Suggest"));
setRecordtransfer(rs.getString("RecordTransfer"));
setVolumnNo(rs.getString("VolumnNo"));
setAttachmentPath(rs.getString("AttachmentPath")); //2003.5.23 add
setFlowNo(rs.getString("FlowNo")); //2003.6.3 add
return true;
}
else
{
return false;
}
}
/**
保存数据到数据库
*/
public void saveToDb()
{
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(Constants.DATEFORMAT);
Properties dbBase = new Properties();
dbBase.setProperty("dsJndiName", Constants.ARCHIVE_DBSOURCE_KEY);
//先清除原有数据
STPoolDataSet data = new STPoolDataSet();
String sql = "DELETE FROM fArchive WHERE SerialNo=" + serialno;
data.executeSQL(sql, dbBase);
sql = "INSERT INTO fArchive(SerialNo, Status, Deleted, RepFlag, ArchiveType, FileType,";
sql += " Title, LiteratureType, TitleRemark, FileNo, FileDate, KeyWord, Code, Category,";
sql += " PageNumber, Duty, OtherDuty, ElectronicFileName, AttachmentTitle, Memo, Copys,";
sql += " LendNum, SecurityClass, SecurityTerm, DecryptionDate, RetentionPeriod, ArchiveDate,";
sql += " DestroyDate, ArchivalCode, DossierNo, ArchiveNo, UnitNo, FilingTrace, HandOver,";
sql += " FilingScripts, ReAppraiseDates, Annotation, abstract, Suggest, RecordTransfer,";
sql += " VolumnNo, AttachmentPath, FlowNo) VALUES("; //5.23modify,6.3
sql += serialno + "," + status + ",'" + deleted + "'," + repflag + ",'" ;
sql += archivetype + "','" ;
sql += filetype + "','" ;
sql += title + "','" ;
sql += literaturetype + "','" ;
sql += titleremark + "','" ;
sql += fileno + "'," ;
if(filedate == null)
{
System.out.println("filedate is null");
sql += "null,'" ;
}
else
{
sql += "cdate('" + sdf.format(filedate) + "'),'" ;
}
sql += keyword + "','";
sql += code + "','";
sql += category + "','" ;
sql += pagenumber + "','" ;
sql += duty + "','" ;
sql += otherduty + "','" ;
sql += electronicfilename + "','" ;
sql += attachmenttitle + "','";
sql += memo + "'," ;
sql += copys + "," ;
sql += lendnum + ",'" ; System.out.println(sql);
sql += securityclass + "',";
sql += securityterm + "," ;
if(decryptiondate == null)
{
System.out.println("decryptiondate is null");
sql += "null,'";
}
else
{
sql += "cdate('" + sdf.format(decryptiondate) + "'),'" ;
}
sql += retentionperiod + "'," ;
if(archivedate == null)
{
System.out.println("filedate is null");
sql += "null,";
}
else
{
sql += "cdate('" + sdf.format(archivedate) + "'),";
}
if(destroydate == null)
{
System.out.println("destroydate is null");
sql += "null,'" ;
}
else
{
sql += "cdate('" + sdf.format(destroydate) + "'),'" ;
}
sql += archivalcode + "','" ;
sql += dossierno + "','" ;
sql += archiveno + "','" ; System.out.println(sql);
sql += unitno + "','" ;
sql += filingtrace + "','" ;
sql += handover + "','" ;
sql += filingscripts + "','" ;
sql += reappraisedates + "','" ;
sql += annotation + "','" ; System.out.println(sql);
sql += abstractmsg + "','" ;
sql += suggest + "','" ;
sql += recordtransfer + "','" ;
sql += volumnNo + "','"; //add案卷号
sql += attachmentPath + "','"; //add,5.23
sql += flowNo + "')"; //6.3, add
//恢复附件
if( (attachmentPath != null) && (attachmentPath.length() > 0) )
{
if( (backupAttachmentPath != null) && (backupAttachmentPath.length() > 0) )
{
CopyFile.copy(attachmentPath, backupAttachmentPath);
}
else
{
System.out.println("恢复附件时出错:没有找到备份文件!");
}
// String source = "d:\\";
// String back = "c:\\xmlbackup\\";
// CopyFile.copy(source+attachmentPath, back+attachmentPath);
}
System.out.println(sql);
data.executeSQL(sql, dbBase);
}
//-------my add--------
public String getFlowNo()
{
return this.flowNo;
}
public void setFlowNo(String flowNo)
{
this.flowNo = (flowNo==null)?"":flowNo;
}
public String getBackupAttachmentPath()
{
return this.backupAttachmentPath;
}
public void setBackupAttachmentPath(String backupAttachmentPath)
{
this.backupAttachmentPath = (backupAttachmentPath==null)?"":backupAttachmentPath;
}
public String getAttachmentPath()
{
return this.attachmentPath;
}
public void setAttachmentPath(String attachmentPath)
{
this.attachmentPath = (attachmentPath == null)?"":attachmentPath;
}
public String getVolumnNo()
{
return this.volumnNo;
}
public void setVolumnNo(String volumnNo)
{
this.volumnNo = (volumnNo == null)?"":volumnNo;
}
public int getStatus()
{
return (this.status);
}
public void setStatus(int status)
{
this.status = status;
}
public String getDeleted()
{
return this.deleted;
}
public void setDeleted(String deleted)
{
this.deleted = (deleted==null)?"":deleted;
}
public int getRepflag()
{
return this.repflag;
}
public void setRepflag(int repflag)
{
this.repflag = repflag;
}
public String getDossierno()
{
return this.dossierno;
}
public void setDossierno(String dossierno)
{
this.dossierno = (dossierno==null)?"":dossierno;
}
public String getUnitno()
{
return this.unitno;
}
public void setUnitno(String unitno)
{
this.unitno = (unitno==null)?"":unitno;
}
//=======my add============
// ----------------------------------------------------------- Properties
/**
* Return the serialno.
*/
public int getSerialno() {
return (this.serialno);
}
/**
* Set the serialno.
*
* @param serialno The new serialno
*/
public void setSerialno(int serialno) {
this.serialno = serialno;
}
/**
* Return the archivetype.
*/
public String getArchivetype() {
return (this.archivetype);
}
/**
* Set the archivetype.
*
* @param archivetype The new archivetype
*/
public void setArchivetype(String archivetype) {
this.archivetype = (archivetype==null)?"":archivetype;
}
/**
* Return the code.
*/
public String getCode() {
return (this.code);
}
/**
* Set the code.
*
* @param code The new code
*/
public void setCode(String code) {
this.code = (code==null)?"":code;
}
/**
* Return the category.
*/
public String getCategory() {
return (this.category);
}
/**
* Set the category.
*
* @param category The new category
*/
public void setCategory(String category) {
this.category = (category==null)?"":category;
}
/**
* Return the filetype.
*/
public String getFiletype() {
return (this.filetype);
}
/**
* Set the filetype.
*
* @param filetype The new filetype
*/
public void setFiletype(String filetype) {
this.filetype = (filetype==null)?"":filetype;
}
/**
* Return the title.
*/
public String getTitle() {
return (this.title);
}
/**
* Set the title.
*
* @param title The new title
*/
public void setTitle(String title) {
this.title = (title==null)?"":title;
}
/**
* Return the titleremark.
*/
public String getTitleremark() {
return (this.titleremark);
}
/**
* Set the titleremark.
*
* @param titleremark The new titleremark
*/
public void setTitleremark(String titleremark) {
this.titleremark = (titleremark==null)?"":titleremark;
}
/**
* Return the fileno.
*/
public String getFileno() {
return (this.fileno);
}
/**
* Set the fileno.
*
* @param fileno The new fileno
*/
public void setFileno(String fileno) {
this.fileno = (fileno==null)?"":fileno;
}
/**
* Return the literaturetype.
*/
public String getLiteraturetype() {
return (this.literaturetype);
}
/**
* Set the literaturetype.
*
* @param literaturetype The new literaturetype
*/
public void setLiteraturetype(String literaturetype) {
this.literaturetype = (literaturetype==null)?"":literaturetype;
}
/**
* Return the filedate.
*/
public Date getFiledate() {
return (this.filedate);
}
/**
* Set the filedate.
*
* @param filedate The new filedate
*/
public void setFiledate(Date filedate) {
this.filedate = filedate;
}
/**
* Set the filedate.
*
* @param filedate The new filedate
*/
public void setFiledate(String filedate) {
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(Constants.DATEFORMAT);
try {
this.filedate = sdf.parse(filedate);
}catch(Exception e) {
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -