📄 activityoperation.java
字号:
/*
* Created on May 14, 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.ActivityDTO;
import com.coshare.joyteam.projectMgr.businessDelegate.WFTemplateMgrDelegate;
import com.coshare.joyteam.projectMgr.businessDelegate.DelegateException;
import com.coshare.joyteam.projectMgr.dto.TemplateDTO;
import com.coshare.joyteam.util.ID;
/**
* @author Edward
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class ActivityOperation
{
private ActivityDTO atDto;
private String activityId;
private String templateId;
private String activityName;
private String activityType;
private String theDescription;
private String pos;
public void setPos(String pos)
{
this.pos = pos;
}
public String getPos()
{
return this.pos;
}
private int copyActivity()
{
if (this.activityId
== null | this.templateId
== null | this.activityName
== null | this.activityType
== null)
return 1;
int atId, tId, atType;
try
{
atId = Integer.parseInt(this.activityId);
tId = Integer.parseInt(this.templateId);
atType = Integer.parseInt(this.activityType);
}
catch (Exception e)
{
return 2;
}
ID templateID = TemplateDTO.intToID(tId);
this.atDto = new ActivityDTO();
atDto.setActivityName(this.activityName);
atDto.setActivityId(atId);
atDto.setActivityType(atType);
atDto.setTemplateId(templateID);
atDto.setTheDescription(this.theDescription);
return 0;
}
/**
* @param activityId The activityId to set.
*/
public void setActivityId(String activityId)
{
this.activityId = activityId;
}
public String getActivityId()
{
return this.activityId;
}
/**
* @return Returns the activityName.
*/
public String getActivityName()
{
return activityName;
}
/**
* @param activityName The activityName to set.
*/
public void setActivityName(String activityName)
{
this.activityName = activityName;
}
public String getTemplateId()
{
return templateId;
}
/**
* @param templateId The templateId to set.
*/
public void setTemplateId(String templateId)
{
this.templateId = templateId;
}
/**
* @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 activityType.
*/
public String getActivityType()
{
return activityType;
}
/**
* @param activityType The activityType to set.
*/
public void setActivityType(String activityType)
{
this.activityType = activityType;
}
public String delActivity()
{
int tId, tType;
try
{
tId = Integer.parseInt(this.templateId);
tType = Integer.parseInt(this.activityType);
}
catch (Exception e)
{
e.printStackTrace();
return "参数型别错误,模板号和活动类型必须为整数";
}
ID templateID = TemplateDTO.intToID(tId);
WFTemplateMgrDelegate td = null;
try
{
td = new WFTemplateMgrDelegate();
td.delActivity(templateID, this.activityName, tType);
td.remove();
}
catch (DelegateException e)
{
try
{
td.remove();
}
catch (DelegateException de)
{
}
e.printStackTrace();
return "添加操作失败";
}
return "删除操作成功";
}
public String addActivity()
{
int temp = this.copyActivity();
if (temp == 1)
return "请确认各项是否填写正确,带*号的内容必须填写";
if (temp == 2)
return "活动号,创建者类型和模板号必须为整数";
WFTemplateMgrDelegate td = null;
try
{
td = new WFTemplateMgrDelegate();
if (this.pos.equals("head"))
{
td.addActivityAhead(this.atDto);
}
else
{
int id = Integer.parseInt(this.pos);
ID activityId = ActivityDTO.intToID(id);
td.addActivityAfter(this.atDto, activityId);
}
try
{
td.remove();
}
catch (DelegateException de)
{
}
}
catch (DelegateException e)
{
try
{
td.remove();
}
catch (DelegateException de)
{
}
e.printStackTrace();
return "添加操作失败";
}
return "添加操作成功";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -