1 21 22 package org.opensubsystems.blog.logic; 23 24 import java.sql.PreparedStatement ; 25 import java.util.List ; 26 27 import junit.extensions.TestSetup; 28 import junit.framework.Test; 29 import junit.framework.TestSuite; 30 31 import org.opensubsystems.blog.data.Blog; 32 import org.opensubsystems.blog.data.Entry; 33 import org.opensubsystems.blog.persist.BlogFactory; 34 import org.opensubsystems.blog.persist.EntryFactory; 35 import org.opensubsystems.blog.persist.db.BlogDatabaseSchema; 36 import org.opensubsystems.core.data.DataObject; 37 import org.opensubsystems.core.error.OSSException; 38 import org.opensubsystems.core.logic.ControllerManager; 39 import org.opensubsystems.core.persist.DataFactoryManager; 40 import org.opensubsystems.core.persist.db.Database; 41 import org.opensubsystems.core.persist.db.DatabaseImpl; 42 import org.opensubsystems.core.persist.db.DatabaseSchemaManager; 43 import org.opensubsystems.core.persist.db.DatabaseTest; 44 import org.opensubsystems.core.persist.db.DatabaseTestSetup; 45 import org.opensubsystems.core.persist.db.DatabaseTestSuite; 46 import org.opensubsystems.core.util.DatabaseUtils; 47 48 56 public final class BlogControllerTest 57 { 58 60 63 private BlogControllerTest( 64 ) 65 { 66 } 68 69 71 77 public static Test suite( 78 ) 79 { 80 TestSuite suite = new DatabaseTestSuite("BlogControllerTest"); 81 suite.addTestSuite(BlogControllerTestInternal.class); 82 TestSetup wrapper = new DatabaseTestSetup(suite); 83 84 return wrapper; 85 } 86 87 92 public static class BlogControllerTestInternal extends DatabaseTest 93 { 94 96 99 protected BlogFactory m_blogFactory; 100 101 104 protected EntryFactory m_entryFactory; 105 106 109 protected BlogController m_blogControl; 110 111 113 116 static 117 { 118 Database dbDatabase; 119 try 120 { 121 dbDatabase = DatabaseImpl.getInstance(); 122 dbDatabase.add(DatabaseSchemaManager.getInstance(BlogDatabaseSchema.class)); 123 } 124 catch (OSSException bfeExc) 125 { 126 throw new RuntimeException ("Unexpected exception.", bfeExc); 127 } 128 } 129 130 136 public BlogControllerTestInternal( 137 String strTestName 138 ) throws Exception 139 { 140 super(strTestName); 141 142 m_blogFactory = (BlogFactory)DataFactoryManager.getInstance( 143 BlogFactory.class); 144 m_entryFactory = (EntryFactory)DataFactoryManager.getInstance( 145 EntryFactory.class); 146 m_blogControl = (BlogController)ControllerManager.getInstance( 147 BlogController.class); 148 } 149 150 152 156 public void testGetBlogByID( 157 ) throws Exception 158 { 159 PreparedStatement statement = null; 160 161 Blog data1 = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, 162 "testfolder1", "testcaption1", 163 "testcomment1", null, null); 164 165 Blog data2 = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, 166 "testfolder2", "testcaption2", 167 "testcomment2", null, null); 168 Blog testdata = null; 169 try 170 { 171 m_transaction.begin(); 172 try 173 { 174 data1 = (Blog)m_blogFactory.create(data1); 175 m_transaction.commit(); 176 } 177 catch (Throwable thr) 178 { 179 m_transaction.rollback(); 180 throw new Exception (thr); 181 } 182 183 m_transaction.begin(); 184 try 185 { 186 data2 = (Blog)m_blogFactory.create(data2); 187 m_transaction.commit(); 188 } 189 catch (Throwable thr) 190 { 191 m_transaction.rollback(); 192 throw new Exception (thr); 193 } 194 195 testdata = (Blog)m_blogControl.get(data2.getId()); 197 198 assertNotNull("Blog 2 should not be null", testdata); 199 assertTrue("Blog 2 is not the same", data2.isSame(testdata)); 200 201 testdata = (Blog)m_blogControl.get(data1.getId()); 203 204 assertNotNull("Blog 1 should not be null", testdata); 205 assertTrue("Blog 1 is not the same", data1.isSame(testdata)); 206 } 207 finally 208 { 209 m_transaction.begin(); 210 try 211 { 212 if ((data1 != null) && (data1.getId() != DataObject.NEW_ID)) 213 { 214 m_blogFactory.delete(data1.getId(), DataObject.NEW_ID); 216 } 217 if ((data2 != null) && (data2.getId() != DataObject.NEW_ID)) 218 { 219 m_blogFactory.delete(data2.getId(), DataObject.NEW_ID); 221 } 222 m_transaction.commit(); 223 } 224 catch (Throwable thr) 225 { 226 m_transaction.rollback(); 227 throw new Exception (thr); 228 } 229 finally 230 { 231 DatabaseUtils.closeStatement(statement); 232 } 233 } 234 } 235 236 240 public void testGetBlogByFolder( 241 ) throws Exception 242 { 243 PreparedStatement statement = null; 244 245 Blog data1 = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, 246 "testfolder1", "testcaption1", 247 "testcomment1", null, null); 248 249 Blog data2 = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, 250 "testfolder2", "testcaption2", 251 "testcomment2", null, null); 252 Blog testdata; 253 254 try 255 { 256 m_transaction.begin(); 257 try 258 { 259 data1 = (Blog)m_blogFactory.create(data1); 260 m_transaction.commit(); 261 } 262 catch (Throwable thr) 263 { 264 m_transaction.rollback(); 265 throw new Exception (thr); 266 } 267 268 m_transaction.begin(); 269 try 270 { 271 data2 = (Blog)m_blogFactory.create(data2); 272 m_transaction.commit(); 273 } 274 catch (Throwable thr) 275 { 276 m_transaction.rollback(); 277 throw new Exception (thr); 278 } 279 280 testdata = (Blog)m_blogControl.get(data2.getFolder()); 282 283 assertNotNull("Blog 2 should not be null", testdata); 284 assertTrue("Blog 2 is not the same", data2.isSame(testdata)); 285 286 testdata = (Blog)m_blogControl.get(data1.getFolder()); 288 289 assertNotNull("Blog 1 should not be null", testdata); 290 assertTrue("Blog 1 is not the same", data1.isSame(testdata)); 291 } 292 finally 293 { 294 m_transaction.begin(); 295 try 296 { 297 if ((data1 != null) && (data1.getId() != DataObject.NEW_ID)) 298 { 299 m_blogFactory.delete(data1.getId(), DataObject.NEW_ID); 301 } 302 if ((data2 != null) && (data2.getId() != DataObject.NEW_ID)) 303 { 304 m_blogFactory.delete(data2.getId(), DataObject.NEW_ID); 306 } 307 m_transaction.commit(); 308 } 309 catch (Throwable thr) 310 { 311 m_transaction.rollback(); 312 throw new Exception (thr); 313 } 314 finally 315 { 316 DatabaseUtils.closeStatement(statement); 317 } 318 } 319 } 320 321 325 public void testGetAll( 326 ) throws Exception 327 { 328 Blog data; 329 int iCount = 123; 331 PreparedStatement statement = null; 332 try 333 { 334 m_transaction.begin(); 335 try 336 { 337 int iIndex; 338 for (iIndex = 0; iIndex < iCount; iIndex++) 339 { 340 data = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, 341 "testfolder_" + iIndex, "testcaption" + iIndex, 342 "testcomment" + iIndex, null, null); 343 m_blogFactory.create(data); 344 } 345 m_transaction.commit(); 346 } 347 catch (Throwable thr) 348 { 349 m_transaction.rollback(); 350 throw new Exception (thr); 351 } 352 353 List lstTestData; 354 lstTestData = m_blogControl.getAll(); 355 assertNotNull("Loaded blog list is null", lstTestData); 356 assertEquals("Number of loaded blogs is incorrect", 357 iCount, lstTestData.size()); 358 } 359 finally 360 { 361 m_transaction.begin(); 362 try 363 { 364 statement = m_connection.prepareStatement("delete from BF_BLOG where FOLDER " + 365 "like 'testfolder_%'"); 366 statement.executeUpdate(); 367 m_transaction.commit(); 368 } 369 catch (Throwable thr) 370 { 371 m_transaction.rollback(); 372 throw new Exception (thr); 373 } 374 finally 375 { 376 DatabaseUtils.closeStatement(statement); 377 } 378 } 379 } 380 381 385 public void testGetEntries( 386 ) throws Exception 387 { 388 PreparedStatement statement = null; 389 390 Blog blog1 = null; 391 Blog blog2 = null; 392 393 Entry data11 = null; 394 Entry data12 = null; 395 Entry data13 = null; 396 Entry data14 = null; 397 398 Entry data21 = null; 399 Entry data22 = null; 400 Entry data23 = null; 401 402 List lstEntries = null; 403 404 try 405 { 406 blog1 = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, "testfolder1", 407 "testcaption1", "testcomment1", null, null); 408 409 m_transaction.begin(); 410 try 411 { 412 blog1 = (Blog)m_blogFactory.create(blog1); 414 m_transaction.commit(); 415 } 416 catch (Throwable thr) 417 { 418 m_transaction.rollback(); 419 throw new Exception (thr); 420 } 421 422 data11 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog1.getId(), 423 "test_entry_caption11", "test_entry_comment11", 424 "test_image_url11", "test_target_url11", null, null); 425 m_transaction.begin(); 426 try 427 { 428 data11 = (Entry)m_entryFactory.create(data11); 429 m_transaction.commit(); 430 } 431 catch (Throwable thr) 432 { 433 m_transaction.rollback(); 434 throw new Exception (thr); 435 } 436 Thread.sleep(1000); 437 438 data12 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog1.getId(), 439 "test_entry_caption12", "test_entry_comment12", 440 "test_image_url12", "test_target_url12", null, null); 441 m_transaction.begin(); 442 try 443 { 444 data12 = (Entry)m_entryFactory.create(data12); 445 m_transaction.commit(); 446 } 447 catch (Throwable thr) 448 { 449 m_transaction.rollback(); 450 throw new Exception (thr); 451 } 452 Thread.sleep(1000); 453 454 data13 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog1.getId(), 455 "test_entry_caption13", "test_entry_comment13", 456 "test_image_url13", "test_target_url13", null, null); 457 m_transaction.begin(); 458 try 459 { 460 data13 = (Entry)m_entryFactory.create(data13); 461 m_transaction.commit(); 462 } 463 catch (Throwable thr) 464 { 465 m_transaction.rollback(); 466 throw new Exception (thr); 467 } 468 Thread.sleep(1000); 469 470 data14 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog1.getId(), 471 "test_entry_caption14", "test_entry_comment14", 472 "test_image_url14", "test_target_url14", null, null); 473 m_transaction.begin(); 474 try 475 { 476 data14 = (Entry)m_entryFactory.create(data14); 477 m_transaction.commit(); 478 } 479 catch (Throwable thr) 480 { 481 m_transaction.rollback(); 482 throw new Exception (thr); 483 } 484 Thread.sleep(1000); 485 486 blog2 = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, "testfolder2", 487 "testcaption2", "testcomment2", null, null); 488 489 m_transaction.begin(); 490 try 491 { 492 blog2 = (Blog)m_blogFactory.create(blog2); 494 m_transaction.commit(); 495 } 496 catch (Throwable thr) 497 { 498 m_transaction.rollback(); 499 throw new Exception (thr); 500 } 501 502 data21 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog2.getId(), 503 "test_entry_caption21", "test_entry_comment21", 504 "test_image_url21", "test_target_url21", null, null); 505 m_transaction.begin(); 506 try 507 { 508 data21 = (Entry)m_entryFactory.create(data21); 509 m_transaction.commit(); 510 } 511 catch (Throwable thr) 512 { 513 m_transaction.rollback(); 514 throw new Exception (thr); 515 } 516 Thread.sleep(1000); 517 518 data22 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog2.getId(), 519 "test_entry_caption22", "test_entry_comment22", 520 "test_image_url22", "test_target_url22", null, null); 521 m_transaction.begin(); 522 try 523 { 524 data22 = (Entry)m_entryFactory.create(data22); 525 m_transaction.commit(); 526 } 527 catch (Throwable thr) 528 { 529 m_transaction.rollback(); 530 throw new Exception (thr); 531 } 532 Thread.sleep(1000); 533 534 data23 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog2.getId(), 535 "test_entry_caption23", "test_entry_comment23", 536 "test_image_url23", "test_target_url23", null, null); 537 m_transaction.begin(); 538 try 539 { 540 data23 = (Entry)m_entryFactory.create(data23); 541 m_transaction.commit(); 542 } 543 catch (Throwable thr) 544 { 545 m_transaction.rollback(); 546 throw new Exception (thr); 547 } 548 549 lstEntries = m_blogControl.getEntries(blog1.getId()); 551 assertNotNull("List of entries for blog 1 should not be null", lstEntries); 552 assertEquals("Size of the list of entries for blog 1 is incorrect", 553 4, lstEntries.size()); 554 assertTrue("Entry 11 is not the same", data11.isSame((Entry)lstEntries.get(3))); 555 assertTrue("Entry 12 is not the same", data12.isSame((Entry)lstEntries.get(2))); 556 assertTrue("Entry 13 is not the same", data13.isSame((Entry)lstEntries.get(1))); 557 assertTrue("Entry 14 is not the same", data14.isSame((Entry)lstEntries.get(0))); 558 559 lstEntries = m_blogControl.getEntries(blog2.getId()); 561 assertNotNull("List of entries for blog 2 should not be null", lstEntries); 562 assertEquals("Size of the list of entries for blog 1 is incorrect", 563 3, lstEntries.size()); 564 assertTrue("Entry 21 is not the same", data21.isSame((Entry)lstEntries.get(2))); 565 assertTrue("Entry 22 is not the same", data22.isSame((Entry)lstEntries.get(1))); 566 assertTrue("Entry 23 is not the same", data23.isSame((Entry)lstEntries.get(0))); 567 } 568 finally 569 { 570 m_transaction.begin(); 571 try 572 { 573 if ((data11 != null) && (data11.getId() != DataObject.NEW_ID)) 574 { 575 m_entryFactory.delete(data11.getId(), DataObject.NEW_ID); 577 } 578 if ((data12 != null) && (data12.getId() != DataObject.NEW_ID)) 579 { 580 m_entryFactory.delete(data12.getId(), DataObject.NEW_ID); 582 } 583 if ((data13 != null) && (data13.getId() != DataObject.NEW_ID)) 584 { 585 m_entryFactory.delete(data13.getId(), DataObject.NEW_ID); 587 } 588 if ((data14 != null) && (data14.getId() != DataObject.NEW_ID)) 589 { 590 m_entryFactory.delete(data14.getId(), DataObject.NEW_ID); 592 } 593 if ((data21 != null) && (data21.getId() != DataObject.NEW_ID)) 594 { 595 m_entryFactory.delete(data21.getId(), DataObject.NEW_ID); 597 } 598 if ((data22 != null) && (data22.getId() != DataObject.NEW_ID)) 599 { 600 m_entryFactory.delete(data22.getId(), DataObject.NEW_ID); 602 } 603 if ((data23 != null) && (data23.getId() != DataObject.NEW_ID)) 604 { 605 m_entryFactory.delete(data23.getId(), DataObject.NEW_ID); 607 } 608 if ((blog1 != null) && (blog1.getId() != DataObject.NEW_ID)) 609 { 610 m_blogFactory.delete(blog1.getId(), DataObject.NEW_ID); 612 } 613 if ((blog2 != null) && (blog2.getId() != DataObject.NEW_ID)) 614 { 615 m_blogFactory.delete(blog2.getId(), DataObject.NEW_ID); 617 } 618 m_transaction.commit(); 619 } 620 catch (Throwable thr) 621 { 622 m_transaction.rollback(); 623 throw new Exception (thr); 624 } 625 finally 626 { 627 DatabaseUtils.closeStatement(statement); 628 } 629 } 630 } 631 632 636 public void testGetWithEntries( 637 ) throws Exception 638 { 639 PreparedStatement statement = null; 640 641 Blog blog1 = null; 642 Blog blog2 = null; 643 644 Entry data11 = null; 645 Entry data12 = null; 646 Entry data13 = null; 647 648 Entry data21 = null; 649 Entry data22 = null; 650 651 Object [] arrObject = null; 652 Blog testBlog = null; 653 List lstEntries = null; 654 655 try 656 { 657 blog1 = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, "testfolder1", 658 "testcaption1", "testcomment1", null, null); 659 660 m_transaction.begin(); 661 try 662 { 663 blog1 = (Blog)m_blogFactory.create(blog1); 665 m_transaction.commit(); 666 } 667 catch (Throwable thr) 668 { 669 m_transaction.rollback(); 670 throw new Exception (thr); 671 } 672 673 data11 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog1.getId(), 674 "test_entry_caption11", "test_entry_comment11", 675 "test_image_url11", "test_target_url11", null, null); 676 m_transaction.begin(); 677 try 678 { 679 data11 = (Entry)m_entryFactory.create(data11); 680 m_transaction.commit(); 681 } 682 catch (Throwable thr) 683 { 684 m_transaction.rollback(); 685 throw new Exception (thr); 686 } 687 Thread.sleep(1000); 688 689 data12 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog1.getId(), 690 "test_entry_caption12", "test_entry_comment12", 691 "test_image_url12", "test_target_url12", null, null); 692 m_transaction.begin(); 693 try 694 { 695 data12 = (Entry)m_entryFactory.create(data12); 696 m_transaction.commit(); 697 } 698 catch (Throwable thr) 699 { 700 m_transaction.rollback(); 701 throw new Exception (thr); 702 } 703 Thread.sleep(1000); 704 705 data13 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog1.getId(), 706 "test_entry_caption13", "test_entry_comment13", 707 "test_image_url13", "test_target_url13", null, null); 708 m_transaction.begin(); 709 try 710 { 711 data13 = (Entry)m_entryFactory.create(data13); 712 m_transaction.commit(); 713 } 714 catch (Throwable thr) 715 { 716 m_transaction.rollback(); 717 throw new Exception (thr); 718 } 719 720 blog2 = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, "testfolder2", 721 "testcaption2", "testcomment2", null, null); 722 723 m_transaction.begin(); 724 try 725 { 726 blog2 = (Blog)m_blogFactory.create(blog2); 728 m_transaction.commit(); 729 } 730 catch (Throwable thr) 731 { 732 m_transaction.rollback(); 733 throw new Exception (thr); 734 } 735 736 data21 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog2.getId(), 737 "test_entry_caption21", "test_entry_comment21", 738 "test_image_url21", "test_target_url21", null, null); 739 m_transaction.begin(); 740 try 741 { 742 data21 = (Entry)m_entryFactory.create(data21); 743 m_transaction.commit(); 744 } 745 catch (Throwable thr) 746 { 747 m_transaction.rollback(); 748 throw new Exception (thr); 749 } 750 Thread.sleep(1000); 751 752 data22 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog2.getId(), 753 "test_entry_caption22", "test_entry_comment22", 754 "test_image_url22", "test_target_url22", null, null); 755 m_transaction.begin(); 756 try 757 { 758 data22 = (Entry)m_entryFactory.create(data22); 759 m_transaction.commit(); 760 } 761 catch (Throwable thr) 762 { 763 m_transaction.rollback(); 764 throw new Exception (thr); 765 } 766 767 arrObject = m_blogControl.getWithEntries(blog1.getFolder()); 769 testBlog = (Blog)arrObject[0]; 770 lstEntries = (List )arrObject[1]; 771 assertNotNull("Blog 1 should not be null", testBlog); 772 assertTrue("Blog 1 is not same", blog1.isSame(testBlog)); 773 774 assertNotNull("List of entries for blog 1 should not be null", lstEntries); 775 assertEquals("Size of the list of entries for blog 1 is incorrect", 776 3, lstEntries.size()); 777 assertTrue("Entry 11 is not the same", data11.isSame((Entry)lstEntries.get(2))); 778 assertTrue("Entry 12 is not the same", data12.isSame((Entry)lstEntries.get(1))); 779 assertTrue("Entry 13 is not the same", data13.isSame((Entry)lstEntries.get(0))); 780 781 arrObject = m_blogControl.getWithEntries(blog2.getFolder()); 783 testBlog = (Blog)arrObject[0]; 784 lstEntries = (List )arrObject[1]; 785 assertNotNull("Blog 2 should not be null", testBlog); 786 assertTrue("Blog 2 is not same", blog2.isSame(testBlog)); 787 788 assertNotNull("List of entries for blog 2 should not be null", lstEntries); 789 assertEquals("Size of the list of entries for blog 1 is incorrect", 790 2, lstEntries.size()); 791 assertTrue("Entry 21 is not the same", data21.isSame((Entry)lstEntries.get(1))); 792 assertTrue("Entry 22 is not the same", data22.isSame((Entry)lstEntries.get(0))); 793 } 794 finally 795 { 796 m_transaction.begin(); 797 try 798 { 799 if ((data11 != null) && (data11.getId() != DataObject.NEW_ID)) 800 { 801 m_entryFactory.delete(data11.getId(), DataObject.NEW_ID); 803 } 804 if ((data12 != null) && (data12.getId() != DataObject.NEW_ID)) 805 { 806 m_entryFactory.delete(data12.getId(), DataObject.NEW_ID); 808 } 809 if ((data13 != null) && (data13.getId() != DataObject.NEW_ID)) 810 { 811 m_entryFactory.delete(data13.getId(), DataObject.NEW_ID); 813 } 814 if ((data21 != null) && (data21.getId() != DataObject.NEW_ID)) 815 { 816 m_entryFactory.delete(data21.getId(), DataObject.NEW_ID); 818 } 819 if ((data22 != null) && (data22.getId() != DataObject.NEW_ID)) 820 { 821 m_entryFactory.delete(data22.getId(), DataObject.NEW_ID); 823 } 824 if ((blog1 != null) && (blog1.getId() != DataObject.NEW_ID)) 825 { 826 m_blogFactory.delete(blog1.getId(), DataObject.NEW_ID); 828 } 829 if ((blog2 != null) && (blog2.getId() != DataObject.NEW_ID)) 830 { 831 m_blogFactory.delete(blog2.getId(), DataObject.NEW_ID); 833 } 834 m_transaction.commit(); 835 } 836 catch (Throwable thr) 837 { 838 m_transaction.rollback(); 839 throw new Exception (thr); 840 } 841 finally 842 { 843 DatabaseUtils.closeStatement(statement); 844 } 845 } 846 } 847 848 852 public void testGetWithEntry( 853 ) throws Exception 854 { 855 PreparedStatement statement = null; 856 857 Blog blog = null; 858 859 Entry data1 = null; 860 Entry data2 = null; 861 Entry data3 = null; 862 863 Object [] arrObject = null; 864 Blog testBlog = null; 865 Entry testEntry = null; 866 867 try 868 { 869 blog = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, "testfolder1", 870 "testcaption1", "testcomment1", null, null); 871 872 m_transaction.begin(); 873 try 874 { 875 blog = (Blog)m_blogFactory.create(blog); 877 m_transaction.commit(); 878 } 879 catch (Throwable thr) 880 { 881 m_transaction.rollback(); 882 throw new Exception (thr); 883 } 884 885 data1 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog.getId(), 886 "test_entry_caption11", "test_entry_comment11", 887 "test_image_url11", "test_target_url11", null, null); 888 m_transaction.begin(); 889 try 890 { 891 data1 = (Entry)m_entryFactory.create(data1); 892 m_transaction.commit(); 893 } 894 catch (Throwable thr) 895 { 896 m_transaction.rollback(); 897 throw new Exception (thr); 898 } 899 Thread.sleep(200); 900 901 data2 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog.getId(), 902 "test_entry_caption12", "test_entry_comment12", 903 "test_image_url12", "test_target_url12", null, null); 904 m_transaction.begin(); 905 try 906 { 907 data2 = (Entry)m_entryFactory.create(data2); 908 m_transaction.commit(); 909 } 910 catch (Throwable thr) 911 { 912 m_transaction.rollback(); 913 throw new Exception (thr); 914 } 915 Thread.sleep(200); 916 917 data3 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog.getId(), 918 "test_entry_caption13", "test_entry_comment13", 919 "test_image_url13", "test_target_url13", null, null); 920 m_transaction.begin(); 921 try 922 { 923 data3 = (Entry)m_entryFactory.create(data3); 924 m_transaction.commit(); 925 } 926 catch (Throwable thr) 927 { 928 m_transaction.rollback(); 929 throw new Exception (thr); 930 } 931 932 arrObject = m_blogControl.getWithEntry(blog.getFolder(), data2.getId()); 934 testBlog = (Blog)arrObject[0]; 935 testEntry = (Entry)arrObject[1]; 936 assertNotNull("Blog should not be null", testBlog); 937 assertTrue("Blog is not same", blog.isSame(testBlog)); 938 939 assertNotNull("Entry should not be null", testEntry); 940 assertTrue("Entry is not same", data2.isSame(testEntry)); 941 942 arrObject = m_blogControl.getWithEntry(blog.getFolder(), data1.getId()); 944 testBlog = (Blog)arrObject[0]; 945 testEntry = (Entry)arrObject[1]; 946 assertNotNull("Blog should not be null", testBlog); 947 assertTrue("Blog is not same", blog.isSame(testBlog)); 948 949 assertNotNull("Entry should not be null", testEntry); 950 assertTrue("Entry is not same", data1.isSame(testEntry)); 951 952 arrObject = m_blogControl.getWithEntry(blog.getFolder(), data3.getId()); 954 testBlog = (Blog)arrObject[0]; 955 testEntry = (Entry)arrObject[1]; 956 assertNotNull("Blog should not be null", testBlog); 957 assertTrue("Blog is not same", blog.isSame(testBlog)); 958 959 assertNotNull("Entry should not be null", testEntry); 960 assertTrue("Entry is not same", data3.isSame(testEntry)); 961 } 962 finally 963 { 964 m_transaction.begin(); 965 try 966 { 967 if ((data1 != null) && (data1.getId() != DataObject.NEW_ID)) 968 { 969 m_entryFactory.delete(data1.getId(), DataObject.NEW_ID); 971 } 972 if ((data2 != null) && (data2.getId() != DataObject.NEW_ID)) 973 { 974 m_entryFactory.delete(data2.getId(), DataObject.NEW_ID); 976 } 977 if ((data3 != null) && (data3.getId() != DataObject.NEW_ID)) 978 { 979 m_entryFactory.delete(data3.getId(), DataObject.NEW_ID); 981 } 982 if ((blog != null) && (blog.getId() != DataObject.NEW_ID)) 983 { 984 m_blogFactory.delete(blog.getId(), DataObject.NEW_ID); 986 } 987 m_transaction.commit(); 988 } 989 catch (Throwable thr) 990 { 991 m_transaction.rollback(); 992 throw new Exception (thr); 993 } 994 finally 995 { 996 DatabaseUtils.closeStatement(statement); 997 } 998 } 999 } 1000 1001 1005 public void testGetWithEntryById( 1006 ) throws Exception 1007 { 1008 PreparedStatement statement = null; 1009 1010 Blog blog = null; 1011 1012 Entry data1 = null; 1013 Entry data2 = null; 1014 Entry data3 = null; 1015 1016 Object [] arrObject = null; 1017 Blog testBlog = null; 1018 Entry testEntry = null; 1019 1020 try 1021 { 1022 blog = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, "testfolder1", 1023 "testcaption1", "testcomment1", null, null); 1024 1025 m_transaction.begin(); 1026 try 1027 { 1028 blog = (Blog)m_blogFactory.create(blog); 1030 m_transaction.commit(); 1031 } 1032 catch (Throwable thr) 1033 { 1034 m_transaction.rollback(); 1035 throw new Exception (thr); 1036 } 1037 1038 data1 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog.getId(), 1039 "test_entry_caption11", "test_entry_comment11", 1040 "test_image_url11", "test_target_url11", null, null); 1041 m_transaction.begin(); 1042 try 1043 { 1044 data1 = (Entry)m_entryFactory.create(data1); 1045 m_transaction.commit(); 1046 } 1047 catch (Throwable thr) 1048 { 1049 m_transaction.rollback(); 1050 throw new Exception (thr); 1051 } 1052 Thread.sleep(200); 1053 1054 data2 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog.getId(), 1055 "test_entry_caption12", "test_entry_comment12", 1056 "test_image_url12", "test_target_url12", null, null); 1057 m_transaction.begin(); 1058 try 1059 { 1060 data2 = (Entry)m_entryFactory.create(data2); 1061 m_transaction.commit(); 1062 } 1063 catch (Throwable thr) 1064 { 1065 m_transaction.rollback(); 1066 throw new Exception (thr); 1067 } 1068 Thread.sleep(200); 1069 1070 data3 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog.getId(), 1071 "test_entry_caption13", "test_entry_comment13", 1072 "test_image_url13", "test_target_url13", null, null); 1073 m_transaction.begin(); 1074 try 1075 { 1076 data3 = (Entry)m_entryFactory.create(data3); 1077 m_transaction.commit(); 1078 } 1079 catch (Throwable thr) 1080 { 1081 m_transaction.rollback(); 1082 throw new Exception (thr); 1083 } 1084 1085 arrObject = m_blogControl.getWithEntry(blog.getId(), data2.getId()); 1087 testBlog = (Blog)arrObject[0]; 1088 testEntry = (Entry)arrObject[1]; 1089 assertNotNull("Blog should not be null", testBlog); 1090 assertTrue("Blog is not same", blog.isSame(testBlog)); 1091 1092 assertNotNull("Entry should not be null", testEntry); 1093 assertTrue("Entry is not same", data2.isSame(testEntry)); 1094 1095 arrObject = m_blogControl.getWithEntry(blog.getId(), data1.getId()); 1097 testBlog = (Blog)arrObject[0]; 1098 testEntry = (Entry)arrObject[1]; 1099 assertNotNull("Blog should not be null", testBlog); 1100 assertTrue("Blog is not same", blog.isSame(testBlog)); 1101 1102 assertNotNull("Entry should not be null", testEntry); 1103 assertTrue("Entry is not same", data1.isSame(testEntry)); 1104 1105 arrObject = m_blogControl.getWithEntry(blog.getId(), data3.getId()); 1107 testBlog = (Blog)arrObject[0]; 1108 testEntry = (Entry)arrObject[1]; 1109 assertNotNull("Blog should not be null", testBlog); 1110 assertTrue("Blog is not same", blog.isSame(testBlog)); 1111 1112 assertNotNull("Entry should not be null", testEntry); 1113 assertTrue("Entry is not same", data3.isSame(testEntry)); 1114 } 1115 finally 1116 { 1117 m_transaction.begin(); 1118 try 1119 { 1120 if ((data1 != null) && (data1.getId() != DataObject.NEW_ID)) 1121 { 1122 m_entryFactory.delete(data1.getId(), DataObject.NEW_ID); 1124 } 1125 if ((data2 != null) && (data2.getId() != DataObject.NEW_ID)) 1126 { 1127 m_entryFactory.delete(data2.getId(), DataObject.NEW_ID); 1129 } 1130 if ((data3 != null) && (data3.getId() != DataObject.NEW_ID)) 1131 { 1132 m_entryFactory.delete(data3.getId(), DataObject.NEW_ID); 1134 } 1135 if ((blog != null) && (blog.getId() != DataObject.NEW_ID)) 1136 { 1137 m_blogFactory.delete(blog.getId(), DataObject.NEW_ID); 1139 } 1140 m_transaction.commit(); 1141 } 1142 catch (Throwable thr) 1143 { 1144 m_transaction.rollback(); 1145 throw new Exception (thr); 1146 } 1147 finally 1148 { 1149 DatabaseUtils.closeStatement(statement); 1150 } 1151 } 1152 } 1153 1154 1159 public void testCreateBlog( 1160 ) throws Exception 1161 { 1162 Blog data = null; 1163 Blog testData = null; 1164 Blog selectedData = null; 1165 1166 data = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, "testfolder", 1167 "testcaption", "testcomment", null, null); 1168 1169 try 1170 { 1171 m_transaction.begin(); 1172 try 1173 { 1174 testData = (Blog)m_blogControl.create(data); 1175 m_transaction.commit(); 1176 } 1177 catch (Throwable thr) 1178 { 1179 m_transaction.rollback(); 1180 throw new Exception (thr); 1181 } 1182 1183 assertNotNull("Blog should not be null", testData); 1184 assertTrue("Id was not generated", testData.getId() != DataObject.NEW_ID); 1185 assertNotNull("Creation timestamp was not generated", 1186 testData.getCreationTimestamp()); 1187 assertNotNull("Modification timestamp are not the same", 1188 testData.getModificationTimestamp()); 1189 assertTrue("Blog is not the same", data.isSame(testData)); 1190 1191 1192 selectedData = (Blog)m_blogFactory.get(data.getId(), DataObject.NEW_ID); 1196 assertNotNull("Blog should be created but was not", selectedData); 1197 assertTrue("Blog is not the same", testData.isSame(selectedData)); 1198 } 1199 finally 1200 { 1201 if ((data != null) && (data.getId() != DataObject.NEW_ID)) 1202 { 1203 m_transaction.begin(); 1204 try 1206 { 1207 m_blogFactory.delete(data.getId(), DataObject.NEW_ID); 1209 m_transaction.commit(); 1210 } 1211 catch (Throwable thr) 1212 { 1213 m_transaction.rollback(); 1214 throw new Exception (thr); 1215 } 1216 } 1217 } 1218 } 1219 1220 1225 public void testCreateEntry( 1226 ) throws Exception 1227 { 1228 Blog blog = null; 1229 Entry data = null; 1230 Entry testData = null; 1231 Entry selectedData = null; 1232 1233 blog = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, "testfolder", 1234 "testcaption", "testcomment", null, null); 1235 1236 try 1237 { 1238 m_transaction.begin(); 1239 try 1240 { 1241 blog = (Blog)m_blogFactory.create(blog); 1242 m_transaction.commit(); 1243 } 1244 catch (Throwable thr) 1245 { 1246 m_transaction.rollback(); 1247 throw new Exception (thr); 1248 } 1249 1250 data = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog.getId(), 1251 "test_entry_caption", "test_entry_comment", 1252 "test_image_url", "test_target_url", null, null); 1253 m_transaction.begin(); 1254 try 1255 { 1256 testData = (Entry)m_blogControl.create(data); 1258 m_transaction.commit(); 1259 } 1260 catch (Throwable thr) 1261 { 1262 m_transaction.rollback(); 1263 throw new Exception (thr); 1264 } 1265 1266 assertNotNull("Entry should not be null", testData); 1267 assertTrue("Id was not generated", testData.getId() != DataObject.NEW_ID); 1268 assertNotNull("Creation timestamp was not generated", 1269 testData.getCreationTimestamp()); 1270 assertNotNull("Modification timestamp are not the same", 1271 testData.getModificationTimestamp()); 1272 assertTrue("Blog is not the same", data.isSame(testData)); 1273 1274 selectedData = (Entry)m_entryFactory.get(data.getId(), DataObject.NEW_ID); 1278 assertNotNull("Entry should be created but was not", selectedData); 1279 assertTrue("Entry is not the same", testData.isSame(selectedData)); 1280 } 1281 finally 1282 { 1283 m_transaction.begin(); 1284 try 1286 { 1287 if ((data != null) && (data.getId() != DataObject.NEW_ID)) 1288 { 1289 m_entryFactory.delete(data.getId(), DataObject.NEW_ID); 1291 } 1292 if ((blog != null) && (blog.getId() != DataObject.NEW_ID)) 1293 { 1294 m_blogFactory.delete(blog.getId(), DataObject.NEW_ID); 1296 } 1297 m_transaction.commit(); 1298 } 1299 catch (Throwable thr) 1300 { 1301 m_transaction.rollback(); 1302 throw new Exception (thr); 1303 } 1304 } 1305 } 1306 1307 1311 public void testSaveBlog( 1312 ) throws Exception 1313 { 1314 Blog data1 = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, 1315 "testfolder1", "testcaption1", 1316 "testcomment1", null, null); 1317 Blog data2 = null; 1318 Blog testdata = null; 1319 Blog selectedData = null; 1320 1321 try 1322 { 1323 m_transaction.begin(); 1324 try 1325 { 1326 data1 = (Blog)m_blogFactory.create(data1); 1327 m_transaction.commit(); 1328 } 1329 catch (Throwable thr) 1330 { 1331 m_transaction.rollback(); 1332 throw new Exception (thr); 1333 } 1334 1335 data2 = new Blog(data1.getId(), DataObject.NEW_ID, 1336 "testfolder2", "testcaption2", 1337 "testcomment2", data1.getCreationTimestamp(), 1338 data1.getModificationTimestamp()); 1339 Thread.sleep(1000); 1340 1341 m_transaction.begin(); 1342 try 1343 { 1344 testdata = (Blog)m_blogControl.save(data2); 1345 m_transaction.commit(); 1346 } 1347 catch (Throwable thr) 1348 { 1349 m_transaction.rollback(); 1350 throw new Exception (thr); 1351 } 1352 1353 selectedData = (Blog)m_blogFactory.get(testdata.getId(), DataObject.NEW_ID); 1354 1355 assertTrue("Modification timestamp not changed", 1358 selectedData.getModificationTimestamp().getTime() 1359 > data1.getModificationTimestamp().getTime()); 1360 assertTrue("Blog is not same", testdata.isSame(selectedData)); 1361 } 1362 finally 1363 { 1364 m_transaction.begin(); 1365 try 1366 { 1367 if ((data1 != null) && (data1.getId() != DataObject.NEW_ID)) 1368 { 1369 m_blogFactory.delete(data1.getId(), DataObject.NEW_ID); 1371 } 1372 m_transaction.commit(); 1373 } 1374 catch (Throwable thr) 1375 { 1376 m_transaction.rollback(); 1377 throw new Exception (thr); 1378 } 1379 } 1380 } 1381 1382 1386 public void testSaveEntry( 1387 ) throws Exception 1388 { 1389 Blog blog = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, 1390 "testfolder1", "testcaption1", 1391 "testcomment1", null, null); 1392 Entry data1 = null; 1393 Entry data2 = null; 1394 Entry testdata = null; 1395 Entry selectedData = null; 1396 1397 try 1398 { 1399 m_transaction.begin(); 1400 try 1401 { 1402 blog = (Blog)m_blogFactory.create(blog); 1403 m_transaction.commit(); 1404 } 1405 catch (Throwable thr) 1406 { 1407 m_transaction.rollback(); 1408 throw new Exception (thr); 1409 } 1410 1411 data1 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog.getId(), 1412 "test_entry_caption1", "test_entry_comment1", 1413 "test_image_url1", "test_target_url1", null, null); 1414 1415 m_transaction.begin(); 1416 try 1417 { 1418 data1 = (Entry)m_entryFactory.create(data1); 1419 m_transaction.commit(); 1420 } 1421 catch (Throwable thr) 1422 { 1423 m_transaction.rollback(); 1424 throw new Exception (thr); 1425 } 1426 1427 data2 = new Entry(data1.getId(), DataObject.NEW_ID, blog.getId(), 1428 "test_entry_caption2", "test_entry_comment2", 1429 "test_image_url2", "test_target_url2", 1430 data1.getCreationTimestamp(), 1431 data1.getModificationTimestamp()); 1432 Thread.sleep(1000); 1433 1434 m_transaction.begin(); 1435 try 1436 { 1437 testdata = (Entry)m_blogControl.save(data2); 1438 m_transaction.commit(); 1439 } 1440 catch (Throwable thr) 1441 { 1442 m_transaction.rollback(); 1443 throw new Exception (thr); 1444 } 1445 1446 selectedData = (Entry)m_entryFactory.get(testdata.getId(), DataObject.NEW_ID); 1447 1448 assertTrue("Modification timestamp not changed", 1451 selectedData.getModificationTimestamp().getTime() 1452 > data1.getModificationTimestamp().getTime()); 1453 assertTrue("Entry is not same", testdata.isSame(selectedData)); 1454 } 1455 finally 1456 { 1457 m_transaction.begin(); 1458 try 1459 { 1460 if ((data1 != null) && (data1.getId() != DataObject.NEW_ID)) 1461 { 1462 m_entryFactory.delete(data1.getId(), DataObject.NEW_ID); 1464 } 1465 if ((blog != null) && (blog.getId() != DataObject.NEW_ID)) 1466 { 1467 m_blogFactory.delete(blog.getId(), DataObject.NEW_ID); 1469 } 1470 m_transaction.commit(); 1471 } 1472 catch (Throwable thr) 1473 { 1474 m_transaction.rollback(); 1475 throw new Exception (thr); 1476 } 1477 } 1478 } 1479 1480 1484 public void testDelete( 1485 ) throws Exception 1486 { 1487 Blog blog = null; 1488 Entry data1 = null; 1489 Entry data2 = null; 1490 Entry selectedData = null; 1491 Blog selectedBlog = null; 1492 1493 try 1494 { 1495 blog = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, "testfolder", 1496 "testcaption", "testcomment", null, null); 1497 1498 m_transaction.begin(); 1499 try 1500 { 1501 blog = (Blog)m_blogFactory.create(blog); 1503 m_transaction.commit(); 1504 } 1505 catch (Throwable thr) 1506 { 1507 m_transaction.rollback(); 1508 throw new Exception (thr); 1509 } 1510 1511 data1 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog.getId(), 1512 "test_entry_caption1", "test_entry_comment1", 1513 "test_image_url1", "test_target_url1", null, null); 1514 data2 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog.getId(), 1515 "test_entry_caption2", "test_entry_comment2", 1516 "test_image_url2", "test_target_url2", null, null); 1517 1518 m_transaction.begin(); 1519 try 1520 { 1521 data1 = (Entry)m_entryFactory.create(data1); 1522 m_transaction.commit(); 1523 } 1524 catch (Throwable thr) 1525 { 1526 m_transaction.rollback(); 1527 throw new Exception (thr); 1528 } 1529 1530 m_transaction.begin(); 1531 try 1532 { 1533 data2 = (Entry)m_entryFactory.create(data2); 1534 m_transaction.commit(); 1535 } 1536 catch (Throwable thr) 1537 { 1538 m_transaction.rollback(); 1539 throw new Exception (thr); 1540 } 1541 1542 m_transaction.begin(); 1543 try 1544 { 1545 m_blogControl.delete(blog.getId()); 1547 m_transaction.commit(); 1548 } 1549 catch (Throwable thr) 1550 { 1551 m_transaction.rollback(); 1552 throw new Exception (thr); 1553 } 1554 1555 selectedData = (Entry)m_entryFactory.get(data2.getId(), DataObject.NEW_ID); 1559 assertNull("Entry 2 should be deleted but was not", selectedData); 1560 data2 = null; 1561 selectedData = (Entry)m_entryFactory.get(data1.getId(), DataObject.NEW_ID); 1562 assertNull("Entry 1 should be deleted but was not", selectedData); 1563 data1 = null; 1564 selectedBlog = (Blog)m_blogFactory.get(blog.getId(), DataObject.NEW_ID); 1565 assertNull("Blog should be deleted but was not", selectedBlog); 1566 blog = null; 1567 } 1568 finally 1569 { 1570 m_transaction.begin(); 1571 try 1572 { 1573 if ((data1 != null) && (data1.getId() != DataObject.NEW_ID)) 1574 { 1575 m_entryFactory.delete(data1.getId(), DataObject.NEW_ID); 1577 } 1578 if ((data2 != null) && (data2.getId() != DataObject.NEW_ID)) 1579 { 1580 m_entryFactory.delete(data2.getId(), DataObject.NEW_ID); 1582 } 1583 if ((blog != null) && (blog.getId() != DataObject.NEW_ID)) 1584 { 1585 m_blogFactory.delete(blog.getId(), DataObject.NEW_ID); 1587 } 1588 m_transaction.commit(); 1589 } 1590 catch (Throwable thr) 1591 { 1592 m_transaction.rollback(); 1593 throw new Exception (thr); 1594 } 1595 } 1596 } 1597 1598 1602 public void testDeleteEntry( 1603 ) throws Exception 1604 { 1605 Blog blog = null; 1606 Entry data1 = null; 1607 Entry data2 = null; 1608 Entry selectedData = null; 1609 1610 try 1611 { 1612 blog = new Blog(DataObject.NEW_ID, DataObject.NEW_ID, "testfolder", 1613 "testcaption", "testcomment", null, null); 1614 1615 m_transaction.begin(); 1616 try 1617 { 1618 blog = (Blog)m_blogFactory.create(blog); 1620 m_transaction.commit(); 1621 } 1622 catch (Throwable thr) 1623 { 1624 m_transaction.rollback(); 1625 throw new Exception (thr); 1626 } 1627 1628 data1 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog.getId(), 1629 "test_entry_caption1", "test_entry_comment1", 1630 "test_image_url1", "test_target_url1", null, null); 1631 data2 = new Entry(DataObject.NEW_ID, DataObject.NEW_ID, blog.getId(), 1632 "test_entry_caption2", "test_entry_comment2", 1633 "test_image_url2", "test_target_url2", null, null); 1634 1635 m_transaction.begin(); 1636 try 1637 { 1638 data1 = (Entry)m_entryFactory.create(data1); 1639 m_transaction.commit(); 1640 } 1641 catch (Throwable thr) 1642 { 1643 m_transaction.rollback(); 1644 throw new Exception (thr); 1645 } 1646 1647 m_transaction.begin(); 1648 try 1649 { 1650 data2 = (Entry)m_entryFactory.create(data2); 1651 m_transaction.commit(); 1652 } 1653 catch (Throwable thr) 1654 { 1655 m_transaction.rollback(); 1656 throw new Exception (thr); 1657 } 1658 1659 m_transaction.begin(); 1660 try 1661 { 1662 m_blogControl.deleteEntry(data2.getId()); 1664 m_transaction.commit(); 1665 } 1666 catch (Throwable thr) 1667 { 1668 m_transaction.rollback(); 1669 throw new Exception (thr); 1670 } 1671 1672 selectedData = (Entry)m_entryFactory.get(data2.getId(), DataObject.NEW_ID); 1675 assertNull("Entry 2 should be deleted but was not", selectedData); 1676 data2 = null; 1677 1678 selectedData = (Entry)m_entryFactory.get(data1.getId(), DataObject.NEW_ID); 1680 assertNotNull("Entry 1 has not be deleted but it was", selectedData); 1681 assertTrue("Entry 1 is not the same", data1.isSame(selectedData)); 1682 } 1683 finally 1684 { 1685 m_transaction.begin(); 1686 try 1687 { 1688 if ((data1 != null) && (data1.getId() != DataObject.NEW_ID)) 1689 { 1690 m_entryFactory.delete(data1.getId(), DataObject.NEW_ID); 1692 } 1693 if ((data2 != null) && (data2.getId() != DataObject.NEW_ID)) 1694 { 1695 m_entryFactory.delete(data2.getId(), DataObject.NEW_ID); 1697 } 1698 if ((blog != null) && (blog.getId() != DataObject.NEW_ID)) 1699 { 1700 m_blogFactory.delete(blog.getId(), DataObject.NEW_ID); 1702 } 1703 m_transaction.commit(); 1704 } 1705 catch (Throwable thr) 1706 { 1707 m_transaction.rollback(); 1708 throw new Exception (thr); 1709 } 1710 } 1711 } 1712 } 1713} 1714 | Popular Tags |