1 16 17 package org.apache.jetspeed.om.registry.base; 18 19 import org.apache.jetspeed.om.SecurityReference; 21 import org.apache.jetspeed.om.registry.MetaInfo; 22 import org.apache.jetspeed.om.registry.Security; 23 import org.apache.jetspeed.om.registry.RegistryEntry; 24 25 32 public class BaseRegistryEntry implements RegistryEntry, java.io.Serializable 33 { 34 protected long id = 0; 35 36 protected String name; 37 38 protected MetaInfo metaInfo = null; 39 40 protected Security security = null; 41 42 protected boolean hidden; 43 44 protected int _hidden; 45 46 47 protected SecurityReference securityRef = null; 48 49 public BaseRegistryEntry() 50 {} 51 52 public BaseRegistryEntry(long id, 53 String name, 54 int _hidden, 55 String title, 56 String description, 57 String image, 58 String role) 59 { 60 this.id = id; 61 this.name = name; 62 this._hidden = _hidden; 63 this.hidden = (_hidden == 1); 64 BaseMetaInfo meta = new BaseMetaInfo(title, description, image); 65 this.setMetaInfo(meta); 66 BaseSecurity security = new BaseSecurity(role); 67 this.setSecurity(security); 68 } 69 70 74 public boolean equals(Object entry) 75 { 76 if (entry==null) 77 { 78 return false; 79 } 80 81 BaseRegistryEntry e = (BaseRegistryEntry)entry; 82 83 if (e.getId()!=getId()) 84 { 85 return false; 86 } 87 88 if (e.isHidden()!=isHidden()) 89 { 90 return false; 91 } 92 93 if (name!=null) 94 { 95 if (!e.name.equals(name)) 96 { 97 return false; 98 } 99 } 100 else 101 { 102 if (e.name!=null) 103 { 104 return false; 105 } 106 } 107 108 if (metaInfo != null) 109 { 110 if (!metaInfo.equals(e.metaInfo)) 111 { 112 return false; 113 } 114 } 115 else 116 { 117 if (e.metaInfo!=null) 118 { 119 return false; 120 } 121 } 122 123 if (security!=null) 124 { 125 if (!security.equals(e.security)) 126 { 127 return false; 128 } 129 } 130 else 131 { 132 if (e.security!=null) 133 { 134 return false; 135 } 136 } 137 138 return true; 139 } 140 141 142 public long getId() 143 { 144 return this.id; 145 } 146 147 148 public String getName() 149 { 150 return this.name; 151 } 152 153 154 public void setName( String name ) 155 { 156 this.name = name; 157 } 158 159 160 public String getTitle() 161 { 162 if (this.metaInfo != null) 163 { 164 String title = this.metaInfo.getTitle(); 165 if (null != title) 166 { 167 return title; 168 } 169 } 170 171 return null; 172 } 173 174 175 public void setTitle(String title) 176 { 177 if (this.metaInfo == null) 178 { 179 this.metaInfo = new BaseMetaInfo(); 180 } 181 182 this.metaInfo.setTitle(title); 183 } 184 185 186 public String getDescription() 187 { 188 if (this.metaInfo != null) 189 { 190 String desc = this.metaInfo.getDescription(); 191 if (null != desc) 192 return desc; 193 } 194 195 return null; 196 } 197 198 199 public void setDescription(String description) 200 { 201 if (this.metaInfo == null) 202 { 203 this.metaInfo = new BaseMetaInfo(); 204 } 205 206 this.metaInfo.setDescription(description); 207 this.description = description; 208 } 209 210 211 public Security getSecurity() 212 { 213 return this.security; 214 } 215 216 217 public void setSecurity( Security security ) 218 { 219 this.security = security; 220 this.role = this.security.getRole(); 221 } 222 223 224 public boolean isHidden() 225 { 226 return this.hidden; 227 } 228 229 230 public void setHidden( boolean hidden ) 231 { 232 this.hidden = hidden; 233 this._hidden = (hidden) ? 1 : 0; 234 } 235 236 238 241 public boolean getHidden() 242 { 243 return this.hidden; 244 } 245 246 249 public BaseSecurity getBaseSecurity() 250 { 251 return (BaseSecurity)this.security; 252 } 253 254 257 public void setBaseSecurity( BaseSecurity security ) 258 { 259 this.security = security; 260 this.role = this.security.getRole(); 261 } 262 263 public MetaInfo getMetaInfo() 264 { 265 return this.metaInfo; 266 } 267 268 271 public void setMetaInfo( MetaInfo metaInfo ) 272 { 273 this.metaInfo = metaInfo; 274 this.title = metaInfo.getTitle(); 275 this.description = metaInfo.getDescription(); 276 this.image = metaInfo.getImage(); 277 } 278 279 281 public BaseMetaInfo getBaseMetaInfo() 282 { 283 return (BaseMetaInfo)this.metaInfo; 284 } 285 286 289 public void setBaseMetaInfo( BaseMetaInfo metaInfo ) 290 { 291 this.metaInfo = metaInfo; 292 this.title = metaInfo.getTitle(); 293 this.description = metaInfo.getDescription(); 294 this.image = metaInfo.getImage(); 295 } 296 297 300 public SecurityReference getSecurityRef() 301 { 302 return securityRef; 303 } 304 305 308 public void setSecurityRef(SecurityReference securityRef) 309 { 310 this.securityRef = securityRef; 311 } 312 313 String title; 315 String description; 316 String image; 317 String role; 318 319 } 320 | Popular Tags |