⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 projectmgrdelegate.java

📁 这是一个工作流管理的后端EJB实现
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package com.coshare.joyteam.projectMgr.businessDelegate;

import java.rmi.RemoteException;
import java.util.Collection;

import javax.ejb.Handle;
import javax.rmi.PortableRemoteObject;

import com.coshare.joyteam.projectMgr.dto.AssignmentDTO;
import com.coshare.joyteam.projectMgr.dto.InstanceDTO;
import com.coshare.joyteam.projectMgr.dto.TaskDTO;
import com.coshare.joyteam.projectMgr.dto.ActivityDTO;
import com.coshare.joyteam.projectMgr.dto.TemplateDTO;
import com.coshare.joyteam.projectMgr.sessionFacade.ProjectMgr;
import com.coshare.joyteam.util.ID;

import java.util.Date;
import java.util.ArrayList;

public class ProjectMgrDelegate
{
	private ProjectMgr remote;
	private Handle handle;

	public ProjectMgrDelegate() throws DelegateException
	{
//		try
//		{
//			ProjectMgrHome home =
//				(ProjectMgrHome) EJBHomeFactory.getFactory().lookUpEJBHome(
//					ProjectMgrHome.class);
//
//			remote = home.create();
//			handle = remote.getHandle();
//		}
//		catch (Exception e)
//		{
//			throw new DelegateException(e);
//		}
	}

	private ProjectMgr getEJB() throws DelegateException
	{
		try
		{
			if (remote == null)
			{
				remote =
					(ProjectMgr) PortableRemoteObject.narrow(
						handle.getEJBObject(),
						ProjectMgr.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);
//		}
	}

	/*
	 *  Task
	 */
	public boolean startTask(ID instanceId, ID taskId) throws DelegateException
	{
//		try
//		{
//			return getEJB().startTask(instanceId, taskId);
//		}
//		catch (RemoteException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
//		catch (DelegateException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
		return true;
	}

	public boolean resumeTask(ID instanceId, ID taskId)
		throws DelegateException
	{
//		try
//		{
//			return getEJB().resumeTask(instanceId, taskId);
//		}
//		catch (RemoteException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
//		catch (DelegateException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
		return true;
	}

	public boolean abortTask(ID instanceId, ID taskId) throws DelegateException
	{
//		try
//		{
//			return getEJB().abortTask(instanceId, taskId);
//		}
//		catch (RemoteException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
//		catch (DelegateException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
		return true;
	}

	public boolean suspendTask(ID instanceId, ID taskId)
		throws DelegateException
	{
//		try
//		{
//			return getEJB().suspendTask(instanceId, taskId);
//		}
//		catch (RemoteException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
//		catch (DelegateException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
		return true;
	}

	public boolean terminateTask(ID instanceId, ID taskId)
		throws DelegateException
	{
//		try
//		{
//			return getEJB().terminateTask(instanceId, taskId);
//		}
//		catch (RemoteException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
//		catch (DelegateException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
		return true;
	}

	public boolean submitTask(ID taskId) throws DelegateException
	{
//		try
//		{
//			return getEJB().submitTask(taskId);
//		}
//		catch (RemoteException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
//		catch (DelegateException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
		return true;
	}

	public int addTask(TaskDTO task) throws DelegateException
	{
//		try
//		{
//			return getEJB().addTask(task);
//		}
//		catch (RemoteException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
//		catch (DelegateException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
		return 1;
	}
	
	
	public int addTaskAfter(TaskDTO task,ID taskId) throws DelegateException
	{

		return 1;
	}
	public int addTaskAhead(TaskDTO task) throws DelegateException
	{

		return 1;
	}

	public int addTaskRel(ID preTaskId, ID sucTaskId) throws DelegateException
	{
//		try
//		{
//			return getEJB().addTaskRel(preTaskId, sucTaskId);
//		}
//		catch (RemoteException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
//		catch (DelegateException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
		return 1;
	}

	public int delTaskRel(ID preTaskId, ID sucTaskId) throws DelegateException
	{
//		try
//		{
//			return getEJB().delTaskRel(preTaskId, sucTaskId);
//		}
//		catch (RemoteException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
//		catch (DelegateException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
		return 1;
	}

	public TaskDTO getTask(ID taskId) throws DelegateException
	{
//		try
//		{
//			return getEJB().getTask(taskId);
//		}
//		catch (RemoteException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
//		catch (DelegateException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
		TaskDTO tDto = new TaskDTO();
		ID activityID = ActivityDTO.intToID(1);
		ID instanceID = InstanceDTO.intToID(1);
		tDto.setActivityId(activityID);
		tDto.setActivityType(1);
		tDto.setTaskId(1);
		tDto.setStatusKey(1);
		tDto.setStartTime( new Date());
		tDto.setExpireTime(100);
		tDto.setEndTime(new Date());
		tDto.setTaskName("设计");
		tDto.setTheDescription("描述");
		tDto.setInstanceId(instanceID);
		
		return tDto;	
	}

	public Collection getTasksOfI(ID instanceId) throws DelegateException
	{
//		try
//		{
//			return getEJB().getTasksOfI(instanceId);
//		}
//		catch (RemoteException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
//		catch (DelegateException e)
//		{
//			e.printStackTrace();
//			throw new DelegateException(e);
//		}
		ArrayList list=new ArrayList();
		for(int i=0;i<5;i++){
			TaskDTO tDto = new TaskDTO();
			ID activityID = ActivityDTO.intToID(i);
			ID instanceID = InstanceDTO.intToID(i);
			tDto.setActivityId(activityID);
			tDto.setActivityType(i);
			tDto.setTaskId(i);
			tDto.setStatusKey(i);
			tDto.setStartTime( new Date());
			tDto.setExpireTime(100);
			tDto.setEndTime(new Date());
			tDto.setTaskName("设计"+i);
			tDto.setTheDescription("描述"+i);
			tDto.setInstanceId(instanceID);
			
			list.add(tDto);	
		}
		return list;
	}

	public Object getTaskRel(ID taskId_1, ID taskId_2) throws DelegateException
	{
		try
		{
			return getEJB().getTaskRel(taskId_1, taskId_2);
		}
		catch (RemoteException e)
		{
			e.printStackTrace();
			throw new DelegateException(e);
		}
		catch (DelegateException e)
		{
			e.printStackTrace();
			throw new DelegateException(e);
		}
	}

	/*
	 *  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)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -