?? wftemplatemgrdelegate.java
字號(hào):
package com.coshare.joyteam.projectMgr.businessDelegate;
import java.rmi.RemoteException;
import java.util.Collection;
import java.util.Date;
import javax.ejb.Handle;
import javax.rmi.PortableRemoteObject;
import com.coshare.joyteam.projectMgr.dto.ActivityDTO;
import com.coshare.joyteam.projectMgr.dto.AssignmentDTO;
import com.coshare.joyteam.projectMgr.dto.TemplateDTO;
import com.coshare.joyteam.projectMgr.sessionFacade.WFTemplateMgr;
import com.coshare.joyteam.util.ID;
import com.coshare.joyteam.projectMgr.dto.ActivityRelDTO;
//測(cè)試添加的內(nèi)容
import java.util.ArrayList;
public class WFTemplateMgrDelegate
{
private WFTemplateMgr remote;
private Handle handle;
public WFTemplateMgrDelegate() throws DelegateException
{
// try
// {
// WFTemplateMgrHome home =
// (WFTemplateMgrHome) EJBHomeFactory.getFactory().lookUpEJBHome(
// WFTemplateMgrHome.class);
//
// remote = home.create();
// handle = remote.getHandle();
// }
// catch (Exception e)
// {
// throw new DelegateException(e);
// }
}
private WFTemplateMgr getEJB() throws DelegateException
{
try
{
if (remote == null)
{
remote =
(WFTemplateMgr) PortableRemoteObject.narrow(
handle.getEJBObject(),
WFTemplateMgr.class);
}
return remote;
}
catch (Exception e)
{
throw new DelegateException(e);
}
}
public void remove() throws DelegateException
{
// try
// {
// getEJB().remove();
// }
// catch (Exception e)
// {
// throw new DelegateException(e);
// }
}
/*
* Template
*/
public int addTemplate(TemplateDTO template) throws DelegateException
{
// try
// {
// return getEJB().addTemplate(template);
// }
// catch (RemoteException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
// catch (DelegateException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
return 1;
}
public int delTemplate(String templateName, int version)
throws DelegateException
{
// try
// {
// return getEJB().delTemplate(templateName, version);
// }
// catch (RemoteException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
// catch (DelegateException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
return 1;
}
public Collection getTemplates(String condition) throws DelegateException
{
// try
// {
// return getEJB().getTemplates(condition);
// }
// catch (RemoteException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
// catch (DelegateException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
ArrayList temp=new ArrayList();
for( int i=0;i<20;i++ ){
TemplateDTO tmpDto = new TemplateDTO();
tmpDto.setCreatingTime( new Date() );
tmpDto.setCreator("創(chuàng)建者"+i);
tmpDto.setCreatorType(i);
tmpDto.setTemplateId(i);
tmpDto.setTemplateName("模板名"+i);
tmpDto.setTheDescription("描述"+i);
tmpDto.setVersion(1);
temp.add(tmpDto);
}
return temp;
}
public TemplateDTO getTemplate(String templateName, int version)
throws DelegateException
{
// try
// {
// return getEJB().getTemplate(templateName, version);
// }
// catch (RemoteException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
// catch (DelegateException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
TemplateDTO tmpDto = new TemplateDTO();
tmpDto.setCreatingTime( new Date() );
tmpDto.setCreator("創(chuàng)建者");
tmpDto.setCreatorType(2);
tmpDto.setTemplateId(1);
tmpDto.setTemplateName("模板名");
tmpDto.setTheDescription("描述");
tmpDto.setVersion(1);
return tmpDto;
}
/*
* Activity
*/
public int addActivity(ActivityDTO activity) throws DelegateException
{
// try
// {
// return getEJB().addActivity(activity);
// }
// catch (RemoteException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
// catch (DelegateException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
return 1;
}
/**
* Add this activity after the activity who's ID is activityId
* @param <code>ActivityDTO</code> activity
* @param <code>ID</code> activityId
* @return the number of lines affected
* @throws DelegateException
*/
public int addActivityAfter(ActivityDTO activity,ID activityId) throws DelegateException
{
return 1;
}
/**
* Add this activity to the head of all the activities associated with a template
* @param <code>ActivityDTO</code> activity
* @return the number of lines affected
* @throws DelegateException
*/
public int addActivityAhead(ActivityDTO activity) throws DelegateException
{
return 1;
}
public int delActivity(
ID templateId,
String activityName,
int activityType)
throws DelegateException
{
// try
// {
// return getEJB().delActivity(templateId, activityName, activityType);
// }
// catch (RemoteException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
// catch (DelegateException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
return 1;
}
public int addActivityRel(ID preActId, ID sucActId)
throws DelegateException
{
// try
// {
// return getEJB().addActivityRel(preActId, sucActId);
// }
// catch (RemoteException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
// catch (DelegateException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
return 1;
}
public int delActivityRel(ID preActId, ID sucActId)
throws DelegateException
{
// try
// {
// return getEJB().delActivityRel(preActId, sucActId);
// }
// catch (RemoteException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
// catch (DelegateException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
return 1;
}
public Collection getActivitiesOfT(ID templateId) throws DelegateException
{
// try
// {
// return getEJB().getActivitiesOfT(templateId);
// }
// catch (RemoteException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
// catch (DelegateException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
ArrayList temp=new ArrayList();
for( int i=0;i<4;i++ ){
ActivityDTO tmpDto = new ActivityDTO();
ID tId=TemplateDTO.intToID(i);
tmpDto.setTemplateId(tId);
tmpDto.setActivityId(i);
tmpDto.setActivityName("活動(dòng)名"+i);
tmpDto.setTheDescription("描述"+i);
tmpDto.setActivityType(2);
temp.add(tmpDto);
}
return temp;
}
public ActivityDTO getActivity(ID activityId) throws DelegateException
{
// try
// {
// return getEJB().getActivity(activityId);
// }
// catch (RemoteException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
// catch (DelegateException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
ActivityDTO tmpDto = new ActivityDTO();
tmpDto.setActivityId(222);
tmpDto.setActivityName("活動(dòng)名"+222);
tmpDto.setTheDescription("描述"+222);
tmpDto.setActivityType(2);
return tmpDto;
}
public ActivityDTO getActivity(
ID templateId,
String activityName,
int activityType)
throws DelegateException
{
// try
// {
// return getEJB().getActivity(templateId, activityName, activityType);
// }
// catch (RemoteException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
// catch (DelegateException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
ActivityDTO tmpDto = new ActivityDTO();
tmpDto.setActivityId(222);
tmpDto.setActivityName("活動(dòng)名"+222);
tmpDto.setTheDescription("描述"+222);
tmpDto.setActivityType(2);
return tmpDto;
}
public Object getActivityRel(ID activityId_1, ID activityId_2)
throws DelegateException
{
// try
// {
// return getEJB().getActivityRel(activityId_1, activityId_2);
// }
// catch (RemoteException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
// catch (DelegateException e)
// {
// e.printStackTrace();
// throw new DelegateException(e);
// }
ActivityRelDTO arDto= new ActivityRelDTO();
arDto.setActivityRelId(1);
arDto.setPreActivity(1);
arDto.setSucActivity(2);
return arDto;
}
/*
* Assignment
*/
public int addAssignment(AssignmentDTO assignment) throws DelegateException
{
try
{
return getEJB().addAssignment(assignment);
}
catch (RemoteException e)
{
e.printStackTrace();
throw new DelegateException(e);
}
catch (DelegateException e)
{
e.printStackTrace();
throw new DelegateException(e);
}
}
public int delAssignment(AssignmentDTO assignment) throws DelegateException
{
try
{
return getEJB().delAssignment(assignment);
}
catch (RemoteException e)
{
e.printStackTrace();
throw new DelegateException(e);
}
catch (DelegateException e)
{
e.printStackTrace();
throw new DelegateException(e);
}
}
public AssignmentDTO getAssignment(ID holderId) throws DelegateException
{
try
{
return getEJB().getAssignment(holderId);
}
catch (RemoteException e)
{
e.printStackTrace();
throw new DelegateException(e);
}
catch (DelegateException e)
{
e.printStackTrace();
throw new DelegateException(e);
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -