1 18 package org.apache.roller.pojos; 19 20 import java.io.File ; 21 import java.lang.reflect.AccessibleObject ; 22 import java.lang.reflect.Field ; 23 import java.math.BigDecimal ; 24 import java.util.Arrays ; 25 import java.util.List ; 26 27 import org.apache.commons.lang.StringUtils; 28 import org.apache.roller.RollerException; 29 import org.apache.roller.model.Roller; 30 import org.apache.roller.model.RollerFactory; 31 import org.apache.roller.util.PojoUtil; 32 33 44 public class RollerConfigData 45 extends org.apache.roller.pojos.PersistentObject 46 implements java.io.Serializable 47 { 48 static final long serialVersionUID = -6354583200913127875L; 49 50 protected java.lang.String id = null; 51 52 55 protected String mDatabaseVersion = "995"; 57 60 protected String mAbsoluteURL = null; 61 62 65 protected Boolean mRssUseCache = Boolean.FALSE; 66 67 70 protected Integer mRssCacheTime = new Integer (3000); 71 72 75 protected Boolean mNewUserAllowed = Boolean.TRUE; 76 77 80 protected String mAdminUsers = "admin"; 81 82 85 protected String mUserThemes = "/themes"; 86 87 91 protected String mEditorPages = 92 "editor-text.jsp,editor-text-js.jsp,editor-rte.jsp,editor-dhtml.jsp,editor-ekit.jsp,editor-wiki-js.jsp"; 93 94 97 protected Boolean mEnableAggregator = Boolean.FALSE; 98 99 102 protected Boolean mUploadEnabled = Boolean.TRUE; 103 104 107 protected BigDecimal mUploadMaxDirMB = new BigDecimal ("2"); 108 109 112 protected BigDecimal mUploadMaxFileMB = new BigDecimal (".5"); 113 114 119 protected String mUploadAllow = ""; 120 121 126 protected String mUploadForbid = ""; 127 128 135 protected String mUploadDir = ""; 136 137 141 protected String uploadPath = "/resources"; 142 143 protected Boolean mMemDebug = Boolean.FALSE; 144 145 149 protected Boolean mAutoformatComments = Boolean.FALSE; 150 151 154 protected Boolean mEscapeCommentHtml = Boolean.FALSE; 155 156 159 protected Boolean mEmailComments = Boolean.FALSE; 160 161 164 protected Boolean mEnableLinkback = Boolean.FALSE; 165 166 169 protected String mSiteName = "Roller-based Site"; 170 171 174 protected String mSiteDescription = "Roller-based Site"; 175 176 179 protected String mEmailAddress = ""; 180 181 184 protected String mIndexDir = "${user.home}" + File.separator 185 + "roller-index"; 186 187 190 protected Boolean mEncryptPasswords = Boolean.FALSE; 191 192 protected String mAlgorithm = "SHA"; 193 194 197 protected String mRefererSpamWords = ""; 198 199 201 209 public String getId() { 210 return this.id; 211 } 212 213 214 public void setId(String id) { 215 this.id = id; 216 } 217 218 222 public String getAbsoluteURL() 223 { 224 return mAbsoluteURL; 225 } 226 227 public void setAbsoluteURL(String string) 228 { 229 mAbsoluteURL = string; 230 } 231 232 236 public Boolean getRssUseCache() 237 { 238 return mRssUseCache; 239 } 240 241 public void setRssUseCache(Boolean use) 242 { 243 mRssUseCache = use; 244 } 245 246 250 public Integer getRssCacheTime() 251 { 252 return mRssCacheTime; 253 } 254 255 public void setRssCacheTime(Integer cacheTime) 256 { 257 mRssCacheTime = cacheTime; 258 } 259 260 264 public Boolean getNewUserAllowed() 265 { 266 return mNewUserAllowed; 267 } 268 269 public void setNewUserAllowed(Boolean use) 270 { 271 mNewUserAllowed = use; 272 } 273 274 277 public String getAdminUsers() 278 { 279 return mAdminUsers; 280 } 281 284 public void setAdminUsers(String _adminUsers) 285 { 286 mAdminUsers = _adminUsers; 287 } 288 289 293 public String getUserThemes() 294 { 295 return mUserThemes; 296 } 297 298 public void setUserThemes(String str) 299 { 300 mUserThemes = str; 301 } 302 303 307 public String getEditorPages() 308 { 309 return mEditorPages; 310 } 311 312 public void setEditorPages(String _editorPages) 313 { 314 mEditorPages = _editorPages; 315 } 316 317 321 public Boolean getEnableAggregator() 322 { 323 return mEnableAggregator; 324 } 325 326 public void setEnableAggregator(Boolean use) 327 { 328 mEnableAggregator = use; 329 } 330 331 335 public Boolean getUploadEnabled() 336 { 337 return mUploadEnabled; 338 } 339 340 public void setUploadEnabled(Boolean use) 341 { 342 mUploadEnabled = use; 343 } 344 345 350 public BigDecimal getUploadMaxDirMB() 351 { 352 return mUploadMaxDirMB; 353 } 354 355 public void setUploadMaxDirMB(BigDecimal use) 356 { 357 mUploadMaxDirMB = use; 358 } 359 360 365 public BigDecimal getUploadMaxFileMB() 366 { 367 return mUploadMaxFileMB; 368 } 369 370 public void setUploadMaxFileMB(BigDecimal use) 371 { 372 mUploadMaxFileMB = use; 373 } 374 375 379 public String getUploadAllow() 380 { 381 return mUploadAllow; 382 } 383 384 public void setUploadAllow(String _uploadAllow) 385 { 386 mUploadAllow = _uploadAllow; 387 } 388 389 393 public String getUploadForbid() 394 { 395 return mUploadForbid; 396 } 397 398 public void setUploadForbid(String _uploadForbid) 399 { 400 mUploadForbid = _uploadForbid; 401 } 402 403 407 public String getUploadDir() 408 { 409 return mUploadDir; 410 } 411 412 public void setUploadDir(String str) 413 { 414 mUploadDir = str; 415 } 416 417 421 public String getUploadPath() 422 { 423 return uploadPath; 424 } 425 426 public void setUploadPath(String str) 427 { 428 uploadPath = str; 429 } 430 431 435 public Boolean getMemDebug() { return mMemDebug; } 436 437 442 public void setMemDebug(Boolean memDebug) 443 { 444 mMemDebug = memDebug; 445 } 446 447 451 public Boolean getAutoformatComments() 452 { 453 return mAutoformatComments; 454 } 455 456 public void setAutoformatComments(Boolean value) 457 { 458 mAutoformatComments = value; 459 } 460 461 465 public Boolean getEscapeCommentHtml() 466 { 467 return mEscapeCommentHtml; 468 } 469 470 public void setEscapeCommentHtml(Boolean value) 471 { 472 mEscapeCommentHtml = value; 473 } 474 475 481 public Boolean getEmailComments() 482 { 483 return mEmailComments; 484 } 485 486 489 public void setEmailComments(Boolean emailComments) 490 { 491 this.mEmailComments = emailComments; 492 } 493 494 499 public Boolean getEnableLinkback() 500 { 501 return mEnableLinkback; 502 } 503 504 508 public void setEnableLinkback(Boolean b) 509 { 510 mEnableLinkback = b; 511 } 512 513 514 518 public String getSiteDescription() 519 { 520 return mSiteDescription; 521 } 522 523 527 public void setSiteDescription(String string) 528 { 529 mSiteDescription = string; 530 } 531 532 536 public String getSiteName() 537 { 538 return mSiteName; 539 } 540 541 545 public void setSiteName(String string) 546 { 547 mSiteName = string; 548 } 549 550 554 public String getEmailAddress() 555 { 556 return mEmailAddress; 557 } 558 559 563 public void setEmailAddress(String emailAddress) 564 { 565 mEmailAddress = emailAddress; 566 } 567 568 572 public String getIndexDir() { 573 574 return mIndexDir; 575 } 576 577 581 public void setIndexDir(String indexDir) 582 { 583 mIndexDir = indexDir; 584 } 585 586 590 public Boolean getEncryptPasswords() 591 { 592 return mEncryptPasswords; 593 } 594 595 public void setEncryptPasswords(Boolean value) 596 { 597 mEncryptPasswords = value; 598 } 599 600 604 public String getAlgorithm() { 605 606 return mAlgorithm; 607 } 608 609 613 public void setAlgorithm(String algorithm) 614 { 615 mAlgorithm = algorithm; 616 } 617 618 622 public String getDatabaseVersion() { 623 return mDatabaseVersion; 624 } 625 629 public void setDatabaseVersion(String databaseVersion) { 630 mDatabaseVersion = databaseVersion; 631 } 632 633 637 public String getRefererSpamWords() 638 { 639 return this.mRefererSpamWords; 640 } 641 645 public void setRefererSpamWords(String refererSpamWords) 646 { 647 this.mRefererSpamWords = refererSpamWords; 648 } 649 650 652 655 public String [] adminUsersArray() 656 { 657 return StringUtils.split(StringUtils.deleteWhitespace(mAdminUsers), ","); 658 } 659 660 663 public List getEditorPagesList() 664 { 665 return Arrays.asList( 666 StringUtils.split(StringUtils.deleteWhitespace(mEditorPages), ",")); 667 } 668 669 672 public String [] uploadAllowArray() 673 { 674 return StringUtils.split(StringUtils.deleteWhitespace(mUploadAllow), ","); 675 } 676 677 680 public String [] uploadForbidArray() 681 { 682 return StringUtils.split(StringUtils.deleteWhitespace(mUploadForbid), ","); 683 } 684 685 688 public String [] refererSpamWordsArray() 689 { 690 return StringUtils.split(StringUtils.deleteWhitespace(mRefererSpamWords), ","); 691 } 692 693 public void updateValues( RollerConfigData child ) 694 { 695 this.mAbsoluteURL = child.getAbsoluteURL(); 696 this.mRssUseCache = child.getRssUseCache(); 697 this.mRssCacheTime = child.getRssCacheTime(); 698 this.mNewUserAllowed = child.getNewUserAllowed(); 699 this.mAdminUsers = child.getAdminUsers(); 700 this.mDatabaseVersion = child.getDatabaseVersion(); 701 this.mUserThemes = child.getUserThemes(); 702 this.mEditorPages = child.getEditorPages(); 703 this.mEnableAggregator = child.getEnableAggregator(); 704 this.mUploadEnabled = child.getUploadEnabled(); 705 this.mUploadMaxDirMB = child.getUploadMaxDirMB(); 706 this.mUploadMaxFileMB = child.getUploadMaxFileMB(); 707 this.mUploadAllow = child.getUploadAllow(); 708 this.mUploadForbid = child.getUploadForbid(); 709 this.mUploadDir = child.getUploadDir(); 710 this.uploadPath = child.getUploadPath(); 711 this.mMemDebug = child.getMemDebug(); 712 this.mAutoformatComments = child.getAutoformatComments(); 713 this.mEscapeCommentHtml = child.getEscapeCommentHtml(); 714 this.mEmailComments = child.getEmailComments(); 715 this.mEnableLinkback = child.getEnableLinkback(); 716 this.mSiteName = child.getSiteName(); 717 this.mSiteDescription = child.getSiteDescription(); 718 this.mEmailAddress = child.getEmailAddress(); 719 this.mIndexDir = child.getIndexDir(); 720 this.mEncryptPasswords = child.getEncryptPasswords(); 721 this.mAlgorithm = child.getAlgorithm(); 722 this.mRefererSpamWords = child.getRefererSpamWords(); 723 } 724 725 726 public String toString() 727 { 728 StringBuffer buf = new StringBuffer (); 729 buf.append("RollerConfig \n"); 730 Class clazz = getClass(); 731 Field [] fields = clazz.getDeclaredFields(); 732 733 try { 734 AccessibleObject.setAccessible(fields, true); 735 for (int i = 0; i < fields.length; i++) { 736 buf.append( 737 "\t[" 738 + fields[i].getName() 739 + "=" 740 + fields[i].get(this) 741 + "], \n"); 742 } 743 } catch (Exception e) { 744 } 746 747 return buf.toString(); 748 } 749 750 751 public void setData(PersistentObject vo) { 752 if (vo instanceof RollerConfigData) { 753 this.id = ((RollerConfigData)vo).id; 754 updateValues((RollerConfigData)vo); 755 } 756 } 757 758 public boolean equals(Object pOther) 759 { 760 if (pOther instanceof WebsiteData) 761 { 762 RollerConfigData lTest = (RollerConfigData) pOther; 763 boolean lEquals = true; 764 765 lEquals = PojoUtil.equals(lEquals, this.id, lTest.id); 766 lEquals = PojoUtil.equals(lEquals, this.mAbsoluteURL, lTest.getAbsoluteURL()); 767 lEquals = PojoUtil.equals(lEquals, this.mRssUseCache, lTest.getRssUseCache()); 768 lEquals = PojoUtil.equals(lEquals, this.mRssCacheTime, lTest.getRssCacheTime()); 769 lEquals = PojoUtil.equals(lEquals, this.mNewUserAllowed, lTest.getNewUserAllowed()); 770 lEquals = PojoUtil.equals(lEquals, this.mAdminUsers, lTest.getAdminUsers()); 771 lEquals = PojoUtil.equals(lEquals, this.mUserThemes, lTest.getUserThemes()); 772 lEquals = PojoUtil.equals(lEquals, this.mEditorPages, lTest.getEditorPages()); 773 lEquals = PojoUtil.equals(lEquals, this.mEnableAggregator, lTest.getEnableAggregator()); 774 lEquals = PojoUtil.equals(lEquals, this.mUploadEnabled, lTest.getUploadEnabled()); 775 lEquals = PojoUtil.equals(lEquals, this.mUploadMaxDirMB, lTest.getUploadMaxDirMB()); 776 lEquals = PojoUtil.equals(lEquals, this.mUploadMaxFileMB, lTest.getUploadMaxFileMB()); 777 lEquals = PojoUtil.equals(lEquals, this.mUploadAllow, lTest.getUploadAllow()); 778 lEquals = PojoUtil.equals(lEquals, this.mUploadForbid, lTest.getUploadForbid()); 779 lEquals = PojoUtil.equals(lEquals, this.mUploadDir, lTest.getUploadDir()); 780 lEquals = PojoUtil.equals(lEquals, this.uploadPath, lTest.getUploadPath()); 781 lEquals = PojoUtil.equals(lEquals, this.mMemDebug, lTest.getMemDebug()); 782 lEquals = PojoUtil.equals(lEquals, this.mAutoformatComments, lTest.getAutoformatComments()); 783 lEquals = PojoUtil.equals(lEquals, this.mEscapeCommentHtml, lTest.getEscapeCommentHtml()); 784 lEquals = PojoUtil.equals(lEquals, this.mEmailComments, lTest.getEmailComments()); 785 lEquals = PojoUtil.equals(lEquals, this.mEnableLinkback, lTest.getEnableLinkback()); 786 lEquals = PojoUtil.equals(lEquals, this.mSiteName, lTest.getSiteName()); 787 lEquals = PojoUtil.equals(lEquals, this.mSiteDescription, lTest.getSiteDescription()); 788 lEquals = PojoUtil.equals(lEquals, this.mEmailAddress, lTest.getEmailAddress()); 789 lEquals = PojoUtil.equals(lEquals, this.mIndexDir, lTest.getIndexDir()); 790 lEquals = PojoUtil.equals(lEquals, this.mEncryptPasswords, lTest.getEncryptPasswords()); 791 lEquals = PojoUtil.equals(lEquals, this.mAlgorithm, lTest.getAlgorithm()); 792 lEquals = PojoUtil.equals(lEquals, this.mRefererSpamWords, lTest.getRefererSpamWords()); 793 794 return lEquals; 795 } 796 else 797 { 798 return false; 799 } 800 } 801 802 public int hashCode() 803 { 804 return super.hashCode(); 805 } 806 807 } 808 | Popular Tags |