1 26 27 29 package de.nava.informa.impl.hibernate; 30 31 import java.util.ArrayList ; 32 import java.util.Collection ; 33 34 import de.nava.informa.core.CategoryIF; 35 36 44 public class Category implements CategoryIF, java.io.Serializable { 45 46 private int id; 47 private String title; 48 private CategoryIF parent; 49 private Collection children; 50 51 public Category() { 52 this("Unnamed category"); 53 } 54 55 public Category(String title) { 56 setTitle(title); 57 this.children = new ArrayList (); 58 } 59 60 64 70 public int getIntId() { 71 return id; 72 } 73 74 public void setIntId(int id) { 75 this.id = id; 76 } 77 78 public long getId() { 79 return id; 80 } 81 82 public void setId(long longid) { 83 this.id = (int) longid; 84 } 85 86 91 public String getTitle() { 92 return title; 93 } 94 95 public void setTitle(String title) { 96 this.title = title; 97 } 98 99 104 public CategoryIF getParent() { 105 return parent; 106 } 107 108 public void setParent(CategoryIF parent) { 109 this.parent = parent; 110 } 111 112 121 public Collection getChildren() { 122 return children; 123 } 124 125 public void setChildren(Collection children) { 126 this.children = children; 127 } 128 129 public void addChild(CategoryIF child) { 130 children.add(child); 131 child.setParent(this); 132 } 133 134 public void removeChild(CategoryIF child) { 135 children.remove(child); 136 } 137 138 142 public String toString() { 143 return "[Category (" + id + "): " + title + "]"; 144 } 145 146 } 147 | Popular Tags |