1 16 17 package org.apache.jetspeed.om.registry.base; 18 19 import java.util.Vector ; 21 import java.util.Iterator ; 22 23 import org.apache.jetspeed.om.registry.SecurityAccess; 25 import org.apache.jetspeed.om.registry.SecurityAllow; 26 27 33 public class BaseSecurityAccess implements SecurityAccess, java.io.Serializable 34 { 35 36 37 private String action; 38 39 40 private Vector allows = new Vector (); 41 42 43 private Vector ownerAllows = new Vector (); 44 45 46 private transient Vector allAllows = new Vector (); 47 48 49 public BaseSecurityAccess() 50 { 51 } 52 53 57 public boolean equals(Object object) 58 { 59 if (object == null || !(object instanceof SecurityAccess)) 60 { 61 return false; 62 } 63 64 SecurityAccess obj = (SecurityAccess) object; 65 66 if (action != null) 67 { 68 if (!action.equals(obj.getAction())) 69 { 70 return false; 71 } 72 } 73 else 74 { 75 if (obj.getAction() != null) 76 { 77 return false; 78 } 79 } 80 81 Iterator i = allows.iterator(); 82 Iterator i2 = obj.getAllows().iterator(); 83 while (i.hasNext()) 84 { 85 SecurityAllow c1 = (SecurityAllow) i.next(); 86 SecurityAllow c2 = null; 87 88 if (i2.hasNext()) 89 { 90 c2 = (SecurityAllow) i2.next(); 91 } 92 else 93 { 94 return false; 95 } 96 97 if (!c1.equals(c2)) 98 { 99 return false; 100 } 101 } 102 103 if (i2.hasNext()) 104 { 105 return false; 106 } 107 108 i = ownerAllows.iterator(); 109 i2 = obj.getOwnerAllows().iterator(); 110 while (i.hasNext()) 111 { 112 BaseSecurityAllowOwner c1 = (BaseSecurityAllowOwner) i.next(); 113 BaseSecurityAllowOwner c2 = null; 114 115 if (i2.hasNext()) 116 { 117 c2 = (BaseSecurityAllowOwner) i2.next(); 118 } 119 else 120 { 121 return false; 122 } 123 124 if (!c1.equals(c2)) 125 { 126 return false; 127 } 128 } 129 130 if (i2.hasNext()) 131 { 132 return false; 133 } 134 135 return true; 136 } 137 138 141 public String getAction() 142 { 143 return action; 144 } 145 146 149 public void setAction(String action) 150 { 151 this.action = action; 152 } 153 154 157 public Vector getAllows() 158 { 159 if (allows == null) 160 { 161 allows = new Vector (); 162 } 163 return allows; 164 } 165 166 169 public void setAllows(Vector allows) 170 { 171 this.allows = allows; 172 if (this.allAllows != null) 173 { 174 allAllows.removeAllElements(); 175 } 176 } 177 178 181 public Vector getOwnerAllows() 182 { 183 if (ownerAllows == null) 184 { 185 ownerAllows = new Vector (); 186 } 187 return this.ownerAllows; 188 } 189 190 193 public void setOwnerAllows(Vector ownerAllows) 194 { 195 this.ownerAllows = ownerAllows; 196 if (this.allAllows != null) 197 { 198 allAllows.removeAllElements(); 199 } 200 } 201 202 209 public Vector getAllAllows() 210 { 211 int elementCount = 0; 212 if (this.allAllows == null) 213 { 214 allAllows = new Vector (); 215 } 216 217 if (allAllows.isEmpty() == true) 218 { 219 if (this.allows != null) 220 { 221 elementCount += this.allows.size(); 222 allAllows.ensureCapacity(elementCount); 223 allAllows.addAll(this.allows); 224 } 225 226 if (this.ownerAllows != null) 227 { 228 elementCount += this.ownerAllows.size(); 229 allAllows.ensureCapacity(elementCount); 230 allAllows.addAll(this.ownerAllows); 231 } 232 } 233 return this.allAllows; 234 } 235 } 236 | Popular Tags |