FileDocCategorySizeDatePackage
TaskMasterBean.javaAPI DocExample2983Thu Jul 07 09:57:20 BST 2005com.oreilly.jbossnotebook.todo.ejb

TaskMasterBean

public abstract class TaskMasterBean extends Object implements javax.ejb.SessionBean
ejb.bean
name="TaskMaster" type="Stateless" view-type="local"
ejb.ejb-ref
ejb-name="Task" view-type="local" ref-name="ejb/TaskLocal"
ejb.ejb-ref
ejb-name="Comment" view-type="local" ref-name="ejb/CommentLocal"
ejb.permission
unchecked="true"

Fields Summary
Constructors Summary
Methods Summary
public voidcomment(java.lang.String id, java.lang.String comment, java.util.Date date)

ejb.interface-method

        try {
            TaskLocal        task = findTaskLocalById(id);
            CommentLocalHome home = CommentUtil.getLocalHome();

            System.out.println("Creating: " + home.create(comment, date, task));

        } catch (Exception e) {
            e.printStackTrace();
        }

    
public voidcompleteTask(java.lang.String id)

ejb.interface-method

        try {
            TaskLocal task = findTaskLocalById(id);
            task.setCompletedDate(new Date());
            System.out.println("Completed: " + id);

        } catch (Exception e) {
            e.printStackTrace();
        }

    
public TaskLocalcreateTask(java.lang.String user, java.lang.String name)

ejb.interface-method

        try {
            TaskLocalHome home = TaskUtil.getLocalHome();
            TaskLocal     task = home.create(user, name);
            return task;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }

    
public TaskfindTaskById(java.lang.String id)

ejb.interface-method

        return findTaskLocalById(id).getTask();
    
private TaskLocalfindTaskLocalById(java.lang.String id)

        try {
            TaskLocalHome home = TaskUtil.getLocalHome();
            return  home.findByPrimaryKey(id);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    
public java.util.CollectiongetTasksForUser(java.lang.String user)
Returns a set of Task (VO) objects

ejb.interface-method

        Collection results = null;

        try {
            TaskLocalHome home = TaskUtil.getLocalHome();

            results = new ArrayList();
            Iterator it_tasks = home.findTasksForUser(user).iterator();
            while (it_tasks.hasNext()) {
                TaskLocal local = (TaskLocal) it_tasks.next();
                results.add(local.getTask());
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

        return results;