1 21 22 package org.opensubsystems.blog.data; 23 24 import java.sql.Timestamp ; 25 26 import org.opensubsystems.core.data.DataConstant; 27 import org.opensubsystems.core.data.DataObject; 28 import org.opensubsystems.core.data.ModifiableDataObject; 29 30 39 public class Blog extends ModifiableDataObject 40 { 41 43 45 49 protected static int s_iFolderMaxLength; 50 51 55 protected static int s_iCaptionMaxLength; 56 57 61 protected static int s_iCommentsMaxLength; 62 63 67 protected Boolean m_bIsPreformated = null; 68 69 71 74 private static final long serialVersionUID = -6839950852321644561L; 75 76 79 protected String m_strFolder; 80 81 84 protected String m_strCaption; 85 86 89 protected String m_strComments; 90 91 93 static 94 { 95 DataConstant.setDataTypeName(DataConstant.BLOG_DATA_TYPE_OBJ, 96 "Chronicle"); 97 } 98 99 102 public Blog( 103 ) 104 { 105 this(DataObject.NEW_ID, DataObject.NEW_ID, "", "", "", null, null); 106 } 107 108 113 public Blog( 114 int iDomainId 115 ) 116 { 117 this(DataObject.NEW_ID, iDomainId, "", "", "", null, null); 118 } 119 120 131 public Blog( 132 int iId, 133 int iDomainId, 134 String strBlogFolder, 135 String strCaption, 136 String strComments, 137 Timestamp creationTimestamp, 138 Timestamp modificationTimestamp 139 ) 140 { 141 super(iId, iDomainId, creationTimestamp, modificationTimestamp); 142 143 m_strFolder = strBlogFolder.trim(); 144 m_strCaption = strCaption; 145 m_strComments = strComments; 146 } 147 148 150 155 public String getFolder( 156 ) 157 { 158 return m_strFolder; 159 } 160 161 166 public String getCaption( 167 ) 168 { 169 return m_strCaption; 170 } 171 172 177 public String getComments( 178 ) 179 { 180 return m_strComments; 181 } 182 183 186 public static int getCaptionMaxLengthStatic( 187 ) 188 { 189 return s_iCaptionMaxLength; 190 } 191 192 195 public int getCaptionMaxLength( 196 ) 197 { 198 return s_iCaptionMaxLength; 199 } 200 201 204 public static int getCommentsMaxLengthStatic( 205 ) 206 { 207 return s_iCommentsMaxLength; 208 } 209 210 213 public int getCommentsMaxLength( 214 ) 215 { 216 return s_iCommentsMaxLength; 217 } 218 219 222 public static int getFolderMaxLengthStatic( 223 ) 224 { 225 return s_iFolderMaxLength; 226 } 227 228 231 public int getFolderMaxLength( 232 ) 233 { 234 return s_iFolderMaxLength; 235 } 236 237 240 public static void setCaptionMaxLength( 241 int iCaptionMaxLength 242 ) 243 { 244 s_iCaptionMaxLength = iCaptionMaxLength; 245 } 246 247 250 public static void setCommentsMaxLength( 251 int iCommentsMaxLength 252 ) 253 { 254 s_iCommentsMaxLength = iCommentsMaxLength; 255 } 256 257 260 public static void setFolderMaxLength( 261 int iFolderMaxLength 262 ) 263 { 264 s_iFolderMaxLength = iFolderMaxLength; 265 } 266 267 273 public boolean getIsPreformated() 274 { 275 if (m_bIsPreformated == null) 276 { 277 if (m_strComments == null) 278 { 279 m_bIsPreformated = Boolean.FALSE; 280 } 281 else 282 { 283 m_bIsPreformated = ((m_strComments.indexOf('\n') != -1) ? Boolean.TRUE 284 : Boolean.FALSE); 285 } 286 } 287 288 return (m_bIsPreformated == Boolean.TRUE); 289 } 290 291 294 public boolean isSame( 295 Object oObject 296 ) 297 { 298 boolean bReturn = false; 299 Blog data; 300 301 if (oObject == this) 302 { 303 bReturn = true; 304 } 305 else 306 { 307 if (oObject != null && oObject instanceof Blog) 308 { 309 data = (Blog) oObject; 310 bReturn = ((data.getFolder() == null && m_strFolder == null) 311 || data.getFolder().equals(m_strFolder)) 312 && ((data.getCaption() == null && m_strCaption == null) 313 || data.getCaption().equals(m_strCaption)) 314 && ((data.getComments() == null && m_strComments == null) 315 || data.getComments().equals(m_strComments)); 316 } 317 } 318 return bReturn; 319 } 320 } 321 | Popular Tags |