1 16 17 package org.apache.cocoon.samples.tour.beans; 18 19 import java.util.LinkedList ; 20 import java.util.List ; 21 import java.util.Iterator ; 22 import java.util.Collections ; 23 24 27 28 public class TaskBean { 29 private String m_taskName; 30 private String m_assignedTo; 31 private final int m_id; 32 private final LinkedList m_comments = new LinkedList (); 33 public static int m_idCounter; 34 35 public TaskBean() { 36 synchronized(TaskBean.class) { 37 m_id = ++m_idCounter; 38 } 39 } 40 41 public String toString() { 42 final StringBuffer sb = new StringBuffer (); 43 sb.append("TaskBean #" + m_id + " (" + m_taskName + "," + m_assignedTo + ")"); 44 for(Iterator it = m_comments.iterator(); it.hasNext(); ) { 45 sb.append("\n\t"); 46 sb.append(it.next()); 47 } 48 return sb.toString(); 49 } 50 51 public int getId() { 52 return m_id; 53 } 54 55 public String getTaskName() { 56 return m_taskName; 57 } 58 59 public void setTaskName(String m_taskName) { 60 this.m_taskName = m_taskName; 61 } 62 63 public String getAssignedTo() { 64 return m_assignedTo; 65 } 66 67 public void setAssignedTo(String m_assignedTo) { 68 this.m_assignedTo = m_assignedTo; 69 } 70 71 public List getComments() { 72 return m_comments; 73 } 74 75 76 public void setComments(List c) { 77 m_comments.clear(); 78 Collections.copy(m_comments,c); 79 } 80 81 public void addComment(TaskCommentBean tcb) { 82 m_comments.add(tcb); 83 } 84 } 85 | Popular Tags |