1 83 package com.ivata.groupware.business.addressbook.person.group.tree; 84 85 86 import java.io.IOException ; 87 import java.io.ObjectInputStream ; 88 import java.io.ObjectOutputStream ; 89 import java.io.Serializable ; 90 91 import com.ivata.groupware.business.addressbook.person.PersonDO; 92 import com.ivata.groupware.business.addressbook.person.group.GroupDO; 93 import com.ivata.groupware.web.tree.TreeNode; 94 95 96 108 public class PersonTreeNode implements Serializable , TreeNode { 109 110 113 private GroupDO group; 114 115 118 private PersonDO person; 119 120 123 public PersonTreeNode() {} 124 129 public PersonTreeNode(GroupDO group) { 130 this.group = group; 131 } 132 133 138 public PersonTreeNode(PersonDO person) { 139 this.person = person; 140 } 141 142 152 public final GroupDO getGroup() { 153 return group; 154 } 155 156 163 public final Integer getId() { 164 if (person == null) { 165 return group.getId(); 166 } 167 return new Integer (0 - person.getId().intValue()); 168 } 169 177 public final String getName() { 178 return (person != null) ? person.getFileAs() : group.getName(); 179 } 180 181 187 public PersonDO getPerson() { 188 return person; 189 } 190 191 198 private void readObject(final ObjectInputStream ois) throws ClassNotFoundException , IOException { 199 ois.defaultReadObject(); 200 } 201 202 208 private void writeObject(final ObjectOutputStream oos) throws IOException { 209 oos.defaultWriteObject(); 210 } 211 } 212 | Popular Tags |