FileDocCategorySizeDatePackage
TaskBean.javaAPI DocExample2248Thu Jul 07 09:57:40 BST 2005com.oreilly.jbossnotebook.todo.servlet

TaskBean

public class TaskBean extends Object

Fields Summary
private static final String
CURR_TASK
private String
commentText
Constructors Summary
Methods Summary
public java.lang.StringaddComment()

        // System.out.println("Adding a comment: " + commentText);
        try {
            TaskMasterLocalHome home   = TaskMasterUtil.getLocalHome();
            TaskMasterLocal     master = home.create();
            
            String id = getCurrentTask().getId().toString();
            master.comment(id, getComment(), new Date());

            setCurrentTask(master.findTaskById(id));
        } catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    
public java.lang.Stringcomplete()

        
        try {
            TaskMasterLocalHome home   = TaskMasterUtil.getLocalHome();
            TaskMasterLocal     master = home.create();
            
            master.completeTask(getCurrentTask().getId().toString());

        } catch (Exception e) {
            e.printStackTrace();
        }
        
        
        return null;
    
public java.lang.StringgetComment()

        return commentText;
    
public TaskgetCurrentTask()

        return (Task) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get(CURR_TASK);
    
public java.util.CollectiongetTasks()


       
        try {
            TaskMasterLocalHome home   = TaskMasterUtil.getLocalHome();
            TaskMasterLocal     master = home.create();
            
            Collection c = master.getTasksForUser(UserBean.user());
            return c;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    
public voidsetComment(java.lang.String comment)

        commentText = comment;
    
public voidsetCurrentTask(Task task)

        FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(CURR_TASK, task);
    
public java.lang.StringviewTask()

        Task task = (Task) FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get("task");
        setCurrentTask(task);

        return "taskView";