1 package org.roller.pojos; 2 3 import java.util.Date ; 4 5 import org.roller.RollerException; 6 import org.roller.model.Roller; 7 import org.roller.model.RollerFactory; 8 9 10 18 public class PageData 19 extends org.roller.pojos.PersistentObject 20 implements java.io.Serializable 21 { 22 static final long serialVersionUID = -613737191638263428L; 23 24 protected java.lang.String id; 25 protected java.lang.String name; 26 protected java.lang.String description; 27 protected java.lang.String link; 28 protected java.lang.String template; 29 protected java.util.Date updateTime; 30 31 protected WebsiteData mWebsite = null; 32 33 public PageData() 34 { 35 } 36 37 public PageData( 38 java.lang.String id, 39 WebsiteData website, 40 java.lang.String name, 41 java.lang.String description, 42 java.lang.String link, 43 java.lang.String template, 44 java.util.Date updateTime ) 45 { 46 this.id = id; 47 this.mWebsite = website; 48 this.name = name; 49 this.description = description; 50 this.link = link; 51 this.template = template; 52 this.updateTime = (Date )updateTime.clone(); 53 } 54 55 public PageData( PageData otherData ) 56 { 57 this.id = otherData.id; 58 this.mWebsite = otherData.mWebsite; 59 this.name = otherData.name; 60 this.description = otherData.description; 61 this.link = otherData.link; 62 this.template = otherData.template; 63 this.updateTime = otherData.updateTime; 64 65 } 66 67 72 public java.lang.String getId() 73 { 74 return this.id; 75 } 76 77 public void setId( java.lang.String id ) 78 { 79 this.id = id; 80 } 81 82 86 public WebsiteData getWebsite() 87 { 88 return this.mWebsite; 89 } 90 91 public void setWebsite( WebsiteData website ) 92 { 93 this.mWebsite = website; 94 } 95 96 100 public java.lang.String getName() 101 { 102 return this.name; 103 } 104 105 public void setName( java.lang.String name ) 106 { 107 this.name = name; 108 } 109 110 115 public java.lang.String getDescription() 116 { 117 return this.description; 118 } 119 120 public void setDescription( java.lang.String description ) 121 { 122 this.description = description; 123 } 124 125 129 public java.lang.String getLink() 130 { 131 return this.link; 132 } 133 134 public void setLink( java.lang.String link ) 135 { 136 this.link = link; 137 } 138 139 143 public java.lang.String getTemplate() 144 { 145 return this.template; 146 } 147 148 public void setTemplate( java.lang.String template ) 149 { 150 this.template = template; 151 } 152 153 157 public java.util.Date getUpdateTime() 158 { 159 return (Date )this.updateTime.clone(); 160 } 161 162 public void setUpdateTime(final java.util.Date newtime ) 163 { 164 if (newtime != null) 165 { 166 updateTime = (Date )newtime.clone(); 167 } 168 else 169 { 170 updateTime = null; 171 } 172 } 173 174 public String toString() 175 { 176 StringBuffer str = new StringBuffer ("{"); 177 178 str.append("id=" + id + " " + "name=" + name + " " + "description=" 179 + description + " " + "link=" + link + " " + "template=" + template 180 + " " + "updateTime=" + updateTime); 181 str.append('}'); 182 183 return(str.toString()); 184 } 185 186 public boolean equals( Object pOther ) 187 { 188 if( pOther instanceof PageData ) 189 { 190 PageData lTest = (PageData) pOther; 191 boolean lEquals = true; 192 193 if( this.id == null ) 194 { 195 lEquals = lEquals && ( lTest.id == null ); 196 } 197 else 198 { 199 lEquals = lEquals && this.id.equals( lTest.id ); 200 } 201 if( this.mWebsite == null ) 202 { 203 lEquals = lEquals && ( lTest.mWebsite == null ); 204 } 205 else 206 { 207 lEquals = lEquals && this.mWebsite.equals( lTest.mWebsite ); 208 } 209 if( this.name == null ) 210 { 211 lEquals = lEquals && ( lTest.name == null ); 212 } 213 else 214 { 215 lEquals = lEquals && this.name.equals( lTest.name ); 216 } 217 if( this.description == null ) 218 { 219 lEquals = lEquals && ( lTest.description == null ); 220 } 221 else 222 { 223 lEquals = lEquals && this.description.equals( lTest.description ); 224 } 225 if( this.link == null ) 226 { 227 lEquals = lEquals && ( lTest.link == null ); 228 } 229 else 230 { 231 lEquals = lEquals && this.link.equals( lTest.link ); 232 } 233 if( this.template == null ) 234 { 235 lEquals = lEquals && ( lTest.template == null ); 236 } 237 else 238 { 239 lEquals = lEquals && this.template.equals( lTest.template ); 240 } 241 if( this.updateTime == null ) 242 { 243 lEquals = lEquals && ( lTest.updateTime == null ); 244 } 245 else 246 { 247 lEquals = lEquals && this.updateTime.equals( lTest.updateTime ); 248 } 249 250 return lEquals; 251 } 252 else 253 { 254 return false; 255 } 256 } 257 258 public int hashCode() 259 { 260 int result = 17; 261 result = 37*result + ((this.id != null) ? this.id.hashCode() : 0); 262 result = 37*result + ((this.mWebsite != null) ? this.mWebsite.hashCode() : 0); 263 result = 37*result + ((this.name != null) ? this.name.hashCode() : 0); 264 result = 37*result + ((this.description != null) ? this.description.hashCode() : 0); 265 result = 37*result + ((this.link != null) ? this.link.hashCode() : 0); 266 result = 37*result + ((this.template != null) ? this.template.hashCode() : 0); 267 result = 37*result + ((this.updateTime != null) ? this.updateTime.hashCode() : 0); 268 return result; 269 } 270 271 274 public void setData( org.roller.pojos.PersistentObject otherData ) 275 { 276 277 this.id = ((PageData)otherData).id; 278 279 this.mWebsite = ((PageData)otherData).mWebsite; 280 281 this.name = ((PageData)otherData).name; 282 283 this.description = ((PageData)otherData).description; 284 285 this.link = ((PageData)otherData).link; 286 287 this.template = ((PageData)otherData).template; 288 289 this.updateTime = ((PageData)otherData).updateTime; 290 } 291 292 public boolean canSave() throws RollerException 293 { 294 Roller roller = RollerFactory.getRoller(); 295 if (roller.getUser().equals(UserData.SYSTEM_USER)) 296 { 297 return true; 298 } 299 if (roller.getUser().equals(getWebsite().getUser())) 300 { 301 return true; 302 } 303 return false; 304 } 305 306 } 307 | Popular Tags |