?? taskusebean.java
字號:
/* */package com.sun.j2ee.workflow.control.web;import java.util.Collection;import com.sun.j2ee.workflow.util.JNDINames;import com.sun.j2ee.workflow.task.model.TaskModel;import com.sun.j2ee.workflow.task.dao.TaskDAOImpl;import com.sun.j2ee.workflow.task.exceptions.*;import com.sun.j2ee.workflow.control.exceptions.GeneralFailureException;import com.sun.j2ee.workflow.control.exceptions.WorkflowAppException;import com.sun.j2ee.workflow.util.Debug;/** This class is the web-tier representation of the task. * @author Jian (James) Cai */public class TaskUseBean implements java.io.Serializable { private TaskModel task = null; private boolean cached = false; public TaskUseBean() {} public TaskModel getTask(String task_ID) { if (cached==false) { try { TaskDAOImpl taskDa = new TaskDAOImpl(); String task_id = taskDa.findByPrimaryKey(task_ID); Debug.println("found task id: "+task_id); task = taskDa.load(task_id); //account = cust.getDetails(); } catch (TaskDAOFinderException fe) { throw new GeneralFailureException("Unable to find the password details for task " ); } catch (TaskDAOSysException se) { Debug.println("found TaskDAOSysException se" + se.toString()); } return task; } else { task = loadFromCache(task_ID); return task; }} public Collection getTaskByName(String task_name) { Collection tasks = null; try { TaskDAOImpl taskDa = new TaskDAOImpl(); tasks = taskDa.findByName(task_name); Debug.println("found task id: "+task_name); } catch (TaskDAOFinderException fe) { throw new GeneralFailureException("Unable to find the task by name " +task_name ); } catch (TaskDAOSysException se) { Debug.println("found TaskDAOSysException se" + se.toString()); } return tasks; } public Collection getTaskList() { Collection tasks = null; try { TaskDAOImpl taskDa = new TaskDAOImpl(); tasks = taskDa.findAll(); } catch (TaskDAOFinderException fe) { throw new GeneralFailureException("Unable to find all task by name "); } catch (TaskDAOSysException se) { Debug.println("found TaskDAOSysException se" + se.toString()); } return tasks; } public Collection getTaskByProject(String proj_name) { Collection tasks = null; try { TaskDAOImpl taskDa = new TaskDAOImpl(); tasks = taskDa.findByField("project", proj_name); } catch (TaskDAOFinderException fe) { throw new GeneralFailureException("Unable to find all task by name "); } catch (TaskDAOSysException se) { Debug.println("found TaskDAOSysException se" + se.toString()); } return tasks; } public Collection getTaskByStatus(String status) { Collection tasks = null; try { TaskDAOImpl taskDa = new TaskDAOImpl(); tasks = taskDa.findByField("status", status); } catch (TaskDAOFinderException fe) { throw new GeneralFailureException("Unable to find all task by name "); } catch (TaskDAOSysException se) { Debug.println("found TaskDAOSysException se" + se.toString()); } return tasks; } public Collection getTaskByType(String type) { Collection tasks = null; try { TaskDAOImpl taskDa = new TaskDAOImpl(); tasks = taskDa.findByField("type", type); } catch (TaskDAOFinderException fe) { throw new GeneralFailureException("Unable to find all task by name "); } catch (TaskDAOSysException se) { Debug.println("found TaskDAOSysException se" + se.toString()); } return tasks; } public Collection getTaskByField(String field, String key) { Collection tasks = null; try { TaskDAOImpl taskDa = new TaskDAOImpl(); tasks = taskDa.findByField(field, key); } catch (TaskDAOFinderException fe) { throw new GeneralFailureException("Unable to find all task by name "); } catch (TaskDAOSysException se) { Debug.println("found TaskDAOSysException se" + se.toString()); } return tasks; } private TaskModel loadFromCache(String task_ID) { TaskModel task = null; //need to be implemented return task; }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -