📄 templateoperation.java
字号:
/*
* Created on May 13, 2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.coshare.joyteam.projectMgr.webbeans;
import com.coshare.joyteam.projectMgr.dto.TemplateDTO;
import com.coshare.joyteam.projectMgr.businessDelegate.WFTemplateMgrDelegate;
import com.coshare.joyteam.projectMgr.businessDelegate.DelegateException;
import java.util.Date;
/**
* @author Edward
*
* 用于对模板对象进行删除,添加,修改的类
*/
public class TemplateOperation {
private String templateId;
private String templateName;
private String version;
private String creator;
private String creatorType;
private Date creatingTime;
private String theDescription;
private TemplateDTO tmpDto;
public TemplateOperation(){
}
/**
* @return Returns the creatingTime.
*/
public Date getCreatingTime() {
return creatingTime;
}
/**
* @param creatingTime The creatingTime to set.
*/
public void setCreatingTime(Date creatingTime) {
this.creatingTime = creatingTime;
}
/**
* @return Returns the creator.
*/
public String getCreator() {
return creator;
}
/**
* @param creator The creator to set.
*/
public void setCreator(String creator) {
this.creator = creator;
}
/**
* @return Returns the creatorType.
*/
public String getCreatorType() {
return creatorType;
}
/**
* @param creatorType The creatorType to set.
*/
public void setCreatorType(String creatorType) {
this.creatorType = creatorType;
}
/**
* @return Returns the theDescription.
*/
public String getTheDescription() {
return theDescription;
}
/**
* @param theDescription The theDescription to set.
*/
public void setTheDescription(String theDescription) {
this.theDescription = theDescription;
}
/**
* @return Returns the templateId.
*/
public String getTemplateId() {
return templateId;
}
/**
* @return Returns the templateName.
*/
public String getTemplateName() {
return templateName;
}
/**
* @return Returns the version.
*/
public String getVersion() {
return version;
}
/**
* @param templateId The templateId to set.
*/
public void setTemplateId(String templateId) {
this.templateId= templateId;
}
/**
* @param templateName The templateName to set.
*/
public void setTemplateName(String templateName) {
this.templateName = templateName;
}
/**
* @param version The version to set.
*/
public void setVersion(String version) {
this.version = version;
}
/**
* 将此bean中的数据安置到TemplateDTO的对象tmpDto中
*/
private int copyTemplate(){
if( this.templateId==null | this.version==null | this.creatorType==null|this.templateName==null|this.creator==null )
return 1;
int tId,tVersion,tType;
try{
tId=Integer.parseInt(this.templateId);
tVersion = Integer.parseInt(this.version);
tType = Integer.parseInt(this.creatorType);
}catch( Exception e ){
e.printStackTrace();
return 2;
}
tmpDto=new TemplateDTO();
this.tmpDto.setCreatingTime(this.creatingTime);
this.tmpDto.setCreator(this.creator);
this.tmpDto.setCreatorType(tType);
this.tmpDto.setTemplateId(tId);
this.tmpDto.setTemplateName(this.templateName);
this.tmpDto.setTheDescription(this.theDescription);
this.tmpDto.setVersion(tVersion);
return 0;
}
public String delTemplate(){
WFTemplateMgrDelegate td=null;
int tVersion;
try{
tVersion=Integer.parseInt(this.version);
}catch(Exception e){
e.printStackTrace();
return "操作数的型别不合法,注意version为整数";
}
try{
td = new WFTemplateMgrDelegate();
td.delTemplate(this.templateName,tVersion);
}catch(DelegateException e){
try{
td.remove();
}catch( DelegateException de ){}
e.printStackTrace();
return "删除操作失败";
}
return "删除操作成功";
}
public String modifyTemplate(){
return "还没能实现修改";
}
public String addTemplate(){
WFTemplateMgrDelegate td=null;
int temp=this.copyTemplate();
if(temp==1)
return "请确认各项是否填写正确,带*号的内容必须填写";
if(temp==2)
return "版本号,创建者类型和模板号必须为整数";
try{
td = new WFTemplateMgrDelegate();
td.addTemplate(this.tmpDto);
td.remove();
}catch(DelegateException e){
try{
td.remove();
}catch( DelegateException de ){}
e.printStackTrace();
return "添加操作失败";
}
return "添加操作成功";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -