1 17 18 package org.apache.james.imapserver; 19 20 import org.apache.avalon.framework.activity.Initializable; 21 22 import java.io.Serializable ; 23 import java.util.Map ; 24 import java.util.Set ; 25 26 31 32 public class SimpleFolderRecord 33 implements FolderRecord, Serializable , Initializable { 34 35 private final String fullName; 36 private final String owner; 37 private final String absoluteName; 38 39 private boolean nameInUse; 40 private boolean deleted; 41 private int uidValidity; 42 private int highestUID; 43 private Set usersWithLookupRights; 44 private Set usersWithReadRights; 45 private boolean marked; 46 private boolean notSelectableByAnyone; 47 private int exists; 48 private int recent; 49 private Map unseenByUser; 50 51 59 public SimpleFolderRecord( String user, 60 String absName) { 61 owner = user; 63 absoluteName = absName; 64 fullName = absName; 65 } 66 67 public void initialize() { 68 nameInUse = true; 69 deleted = false; 70 uidValidity = 1; 71 highestUID = 1; 72 } 73 74 public String getFullName() { 75 return fullName; 76 } 77 78 public String getUser() { 79 return owner; 80 } 81 82 public String getAbsoluteName() { 83 return absoluteName; 84 } 85 86 public void setNameInUse(boolean state) { 87 nameInUse = state; 88 } 89 90 public boolean isNameInUse() { 91 return nameInUse; 92 } 93 94 public void setDeleted(boolean state) { 95 deleted = state; 96 } 97 98 public boolean isDeleted() { 99 return deleted; 100 } 101 102 public void setUidValidity(int uidV) { 103 if (uidV > uidValidity) { 104 uidValidity = uidV; 105 } 106 } 107 108 public int getUidValidity() { 109 return uidValidity; 110 } 111 112 public void setHighestUid(int uid) { 113 highestUID = uid; 114 } 115 116 public int getHighestUid() { 117 return highestUID; 118 } 119 120 public void setLookupRights(Set users) { 121 usersWithLookupRights = users; 122 } 123 124 public boolean hasLookupRights(String user) { 125 return usersWithLookupRights.contains(user) ; 126 } 127 128 public void setReadRights(Set users) { 129 usersWithReadRights = users; 130 } 131 132 public boolean hasReadRights(String user) { 133 return usersWithReadRights.contains(user) ; 134 } 135 136 public void setMarked(boolean mark) { 137 marked = mark; 138 } 139 140 public boolean isMarked() { 141 return marked; 142 } 143 144 public void setNotSelectableByAnyone(boolean state) { 145 notSelectableByAnyone = state; 146 } 147 148 public boolean isNotSelectableByAnyone() { 149 return notSelectableByAnyone; 150 } 151 152 public boolean isSelectable(String user) { 153 return (!notSelectableByAnyone && hasReadRights(user)); 154 } 155 156 public void setExists(int num) { 157 exists = num; 158 } 159 160 public int getExists() { 161 return exists; 162 } 163 164 public void setRecent(int num) { 165 recent = num; 166 } 167 168 public int getRecent() { 169 return recent; 170 } 171 172 public void setUnseenbyUser(Map unseen) { 173 unseenByUser = unseen; 174 } 175 176 public int getUnseen(String user) { 177 if (unseenByUser.containsKey(user)) { 178 Integer unseen = ((Integer )unseenByUser.get(user)); 179 return unseen.intValue(); 180 } else { 181 return exists; 182 } 183 } 184 } 185 | Popular Tags |