1 28 package net.sf.jasperreports.engine; 29 30 import java.awt.Image ; 31 import java.io.InputStream ; 32 import java.io.OutputStream ; 33 import java.sql.Connection ; 34 import java.util.Collection ; 35 import java.util.Map ; 36 37 import net.sf.jasperreports.engine.design.JasperDesign; 38 import net.sf.jasperreports.engine.util.JRLoader; 39 import net.sf.jasperreports.engine.xml.JRXmlLoader; 40 41 42 58 public class JasperManager 59 { 60 61 62 65 public static void runReportToPdfFile( 66 String sourceFileName, 67 Map parameters, 68 Connection conn 69 ) throws JRException 70 { 71 JasperRunManager.runReportToPdfFile( 72 sourceFileName, 73 parameters, 74 conn 75 ); 76 } 77 78 79 82 public static void runReportToPdfFile( 83 String sourceFileName, 84 String destFileName, 85 Map parameters, 86 Connection conn 87 ) throws JRException 88 { 89 JasperRunManager.runReportToPdfFile( 90 sourceFileName, 91 destFileName, 92 parameters, 93 conn 94 ); 95 } 96 97 98 101 public static void runReportToPdfStream( 102 InputStream inputStream, 103 OutputStream outputStream, 104 Map parameters, 105 Connection conn 106 ) throws JRException 107 { 108 JasperRunManager.runReportToPdfStream( 109 inputStream, 110 outputStream, 111 parameters, 112 conn 113 ); 114 } 115 116 117 120 public static byte[] runReportToPdf( 121 String sourceFileName, 122 Map parameters, 123 Connection conn 124 ) throws JRException 125 { 126 return JasperRunManager.runReportToPdf( 127 sourceFileName, 128 parameters, 129 conn 130 ); 131 } 132 133 134 137 public static byte[] runReportToPdf( 138 InputStream inputStream, 139 Map parameters, 140 Connection conn 141 ) throws JRException 142 { 143 return JasperRunManager.runReportToPdf( 144 inputStream, 145 parameters, 146 conn 147 ); 148 } 149 150 151 154 public static byte[] runReportToPdf( 155 JasperReport jasperReport, 156 Map parameters, 157 Connection conn 158 ) throws JRException 159 { 160 return JasperRunManager.runReportToPdf( 161 jasperReport, 162 parameters, 163 conn 164 ); 165 } 166 167 168 171 public static void runReportToPdfFile( 172 String sourceFileName, 173 Map parameters, 174 JRDataSource jrDataSource 175 ) throws JRException 176 { 177 JasperRunManager.runReportToPdfFile( 178 sourceFileName, 179 parameters, 180 jrDataSource 181 ); 182 } 183 184 185 188 public static void runReportToPdfFile( 189 String sourceFileName, 190 String destFileName, 191 Map parameters, 192 JRDataSource jrDataSource 193 ) throws JRException 194 { 195 JasperRunManager.runReportToPdfFile( 196 sourceFileName, 197 destFileName, 198 parameters, 199 jrDataSource 200 ); 201 } 202 203 204 207 public static void runReportToPdfStream( 208 InputStream inputStream, 209 OutputStream outputStream, 210 Map parameters, 211 JRDataSource jrDataSource 212 ) throws JRException 213 { 214 JasperRunManager.runReportToPdfStream( 215 inputStream, 216 outputStream, 217 parameters, 218 jrDataSource 219 ); 220 } 221 222 223 226 public static byte[] runReportToPdf( 227 String sourceFileName, 228 Map parameters, 229 JRDataSource jrDataSource 230 ) throws JRException 231 { 232 return JasperRunManager.runReportToPdf( 233 sourceFileName, 234 parameters, 235 jrDataSource 236 ); 237 } 238 239 240 243 public static byte[] runReportToPdf( 244 InputStream inputStream, 245 Map parameters, 246 JRDataSource jrDataSource 247 ) throws JRException 248 { 249 return JasperRunManager.runReportToPdf( 250 inputStream, 251 parameters, 252 jrDataSource 253 ); 254 } 255 256 257 260 public static byte[] runReportToPdf( 261 JasperReport jasperReport, 262 Map parameters, 263 JRDataSource jrDataSource 264 ) throws JRException 265 { 266 return JasperRunManager.runReportToPdf( 267 jasperReport, 268 parameters, 269 jrDataSource 270 ); 271 } 272 273 274 277 public static String printReportToPdfFile(String sourceFileName) throws JRException 278 { 279 return JasperExportManager.exportReportToPdfFile(sourceFileName); 280 } 281 282 283 286 public static void printReportToPdfFile( 287 String sourceFileName, 288 String destFileName 289 ) throws JRException 290 { 291 JasperExportManager.exportReportToPdfFile( 292 sourceFileName, 293 destFileName 294 ); 295 } 296 297 298 301 public static void printReportToPdfFile( 302 JasperPrint jasperPrint, 303 String destFileName 304 ) throws JRException 305 { 306 JasperExportManager.exportReportToPdfFile( 307 jasperPrint, 308 destFileName 309 ); 310 } 311 312 313 316 public static void printReportToPdfStream( 317 InputStream inputStream, 318 OutputStream outputStream 319 ) throws JRException 320 { 321 JasperExportManager.exportReportToPdfStream( 322 inputStream, 323 outputStream 324 ); 325 } 326 327 328 331 public static void printReportToPdfStream( 332 JasperPrint jasperPrint, 333 OutputStream outputStream 334 ) throws JRException 335 { 336 JasperExportManager.exportReportToPdfStream( 337 jasperPrint, 338 outputStream 339 ); 340 } 341 342 343 346 public static byte[] printReportToPdf(JasperPrint jasperPrint) throws JRException 347 { 348 return JasperExportManager.exportReportToPdf(jasperPrint); 349 } 350 351 352 355 public static boolean printReport( 356 String sourceFileName, 357 boolean withPrintDialog 358 ) throws JRException 359 { 360 return JasperPrintManager.printReport( 361 sourceFileName, 362 withPrintDialog 363 ); 364 } 365 366 367 370 public static boolean printReport( 371 InputStream inputStream, 372 boolean withPrintDialog 373 ) throws JRException 374 { 375 return JasperPrintManager.printReport( 376 inputStream, 377 withPrintDialog 378 ); 379 } 380 381 382 385 public static boolean printReport( 386 JasperPrint jasperPrint, 387 boolean withPrintDialog 388 ) throws JRException 389 { 390 return JasperPrintManager.printReport( 391 jasperPrint, 392 withPrintDialog 393 ); 394 } 395 396 397 400 public static boolean printPage( 401 String sourceFileName, 402 int pageIndex, 403 boolean withPrintDialog 404 ) throws JRException 405 { 406 return JasperPrintManager.printPage( 407 sourceFileName, 408 pageIndex, 409 withPrintDialog 410 ); 411 } 412 413 414 417 public static boolean printPage( 418 InputStream inputStream, 419 int pageIndex, 420 boolean withPrintDialog 421 ) throws JRException 422 { 423 return JasperPrintManager.printPage( 424 inputStream, 425 pageIndex, 426 withPrintDialog 427 ); 428 } 429 430 431 434 public static boolean printPage( 435 JasperPrint jasperPrint, 436 int pageIndex, 437 boolean withPrintDialog 438 ) throws JRException 439 { 440 return JasperPrintManager.printPage( 441 jasperPrint, 442 pageIndex, 443 withPrintDialog 444 ); 445 } 446 447 448 451 public static boolean printPages( 452 String sourceFileName, 453 int firstPageIndex, 454 int lastPageIndex, 455 boolean withPrintDialog 456 ) throws JRException 457 { 458 return JasperPrintManager.printPages( 459 sourceFileName, 460 firstPageIndex, 461 lastPageIndex, 462 withPrintDialog 463 ); 464 } 465 466 467 470 public static boolean printPages( 471 InputStream inputStream, 472 int firstPageIndex, 473 int lastPageIndex, 474 boolean withPrintDialog 475 ) throws JRException 476 { 477 return JasperPrintManager.printPages( 478 inputStream, 479 firstPageIndex, 480 lastPageIndex, 481 withPrintDialog 482 ); 483 } 484 485 486 489 public static boolean printPages( 490 JasperPrint jasperPrint, 491 int firstPageIndex, 492 int lastPageIndex, 493 boolean withPrintDialog 494 ) throws JRException 495 { 496 return JasperPrintManager.printPages( 497 jasperPrint, 498 firstPageIndex, 499 lastPageIndex, 500 withPrintDialog 501 ); 502 } 503 504 505 508 public static Image printPageToImage( 509 String sourceFileName, 510 int pageIndex, 511 float zoom 512 ) throws JRException 513 { 514 return JasperPrintManager.printPageToImage( 515 sourceFileName, 516 pageIndex, 517 zoom 518 ); 519 } 520 521 522 525 public static Image printPageToImage( 526 InputStream inputStream, 527 int pageIndex, 528 float zoom 529 ) throws JRException 530 { 531 return JasperPrintManager.printPageToImage( 532 inputStream, 533 pageIndex, 534 zoom 535 ); 536 } 537 538 539 542 public static Image printPageToImage( 543 JasperPrint jasperPrint, 544 int pageIndex, 545 float zoom 546 ) throws JRException 547 { 548 return JasperPrintManager.printPageToImage( 549 jasperPrint, 550 pageIndex, 551 zoom 552 ); 553 } 554 555 556 559 public static String fillReportToFile( 560 String sourceFileName, 561 Map parameters, 562 Connection conn 563 ) throws JRException 564 { 565 return JasperFillManager.fillReportToFile( 566 sourceFileName, 567 parameters, 568 conn 569 ); 570 } 571 572 573 576 public static void fillReportToFile( 577 String sourceFileName, 578 String destFileName, 579 Map parameters, 580 Connection conn 581 ) throws JRException 582 { 583 JasperFillManager.fillReportToFile( 584 sourceFileName, 585 destFileName, 586 parameters, 587 conn 588 ); 589 } 590 591 592 595 public static void fillReportToFile( 596 JasperReport jasperReport, 597 String destFileName, 598 Map parameters, 599 Connection conn 600 ) throws JRException 601 { 602 JasperFillManager.fillReportToFile( 603 jasperReport, 604 destFileName, 605 parameters, 606 conn 607 ); 608 } 609 610 611 614 public static JasperPrint fillReport( 615 String sourceFileName, 616 Map parameters, 617 Connection conn 618 ) throws JRException 619 { 620 return JasperFillManager.fillReport( 621 sourceFileName, 622 parameters, 623 conn 624 ); 625 } 626 627 628 631 public static void fillReportToStream( 632 InputStream inputStream, 633 OutputStream outputStream, 634 Map parameters, 635 Connection conn 636 ) throws JRException 637 { 638 JasperFillManager.fillReportToStream( 639 inputStream, 640 outputStream, 641 parameters, 642 conn 643 ); 644 } 645 646 647 650 public static void fillReportToStream( 651 JasperReport jasperReport, 652 OutputStream outputStream, 653 Map parameters, 654 Connection conn 655 ) throws JRException 656 { 657 JasperFillManager.fillReportToStream( 658 jasperReport, 659 outputStream, 660 parameters, 661 conn 662 ); 663 } 664 665 666 669 public static JasperPrint fillReport( 670 InputStream inputStream, 671 Map parameters, 672 Connection conn 673 ) throws JRException 674 { 675 return JasperFillManager.fillReport( 676 inputStream, 677 parameters, 678 conn 679 ); 680 } 681 682 683 686 public static JasperPrint fillReport( 687 JasperReport jasperReport, 688 Map parameters, 689 Connection conn 690 ) throws JRException 691 { 692 return JasperFillManager.fillReport( 693 jasperReport, 694 parameters, 695 conn 696 ); 697 } 698 699 700 703 public static String fillReportToFile( 704 String sourceFileName, 705 Map parameters, 706 JRDataSource jrDataSource 707 ) throws JRException 708 { 709 return JasperFillManager.fillReportToFile( 710 sourceFileName, 711 parameters, 712 jrDataSource 713 ); 714 } 715 716 717 720 public static void fillReportToFile( 721 String sourceFileName, 722 String destFileName, 723 Map parameters, 724 JRDataSource jrDataSource 725 ) throws JRException 726 { 727 JasperFillManager.fillReportToFile( 728 sourceFileName, 729 destFileName, 730 parameters, 731 jrDataSource 732 ); 733 } 734 735 736 739 public static void fillReportToFile( 740 JasperReport jasperReport, 741 String destFileName, 742 Map parameters, 743 JRDataSource jrDataSource 744 ) throws JRException 745 { 746 JasperFillManager.fillReportToFile( 747 jasperReport, 748 destFileName, 749 parameters, 750 jrDataSource 751 ); 752 } 753 754 755 758 public static JasperPrint fillReport( 759 String sourceFileName, 760 Map parameters, 761 JRDataSource jrDataSource 762 ) throws JRException 763 { 764 return JasperFillManager.fillReport( 765 sourceFileName, 766 parameters, 767 jrDataSource 768 ); 769 } 770 771 772 775 public static void fillReportToStream( 776 InputStream inputStream, 777 OutputStream outputStream, 778 Map parameters, 779 JRDataSource jrDataSource 780 ) throws JRException 781 { 782 JasperFillManager.fillReportToStream( 783 inputStream, 784 outputStream, 785 parameters, 786 jrDataSource 787 ); 788 } 789 790 791 794 public static void fillReportToStream( 795 JasperReport jasperReport, 796 OutputStream outputStream, 797 Map parameters, 798 JRDataSource jrDataSource 799 ) throws JRException 800 { 801 JasperFillManager.fillReportToStream( 802 jasperReport, 803 outputStream, 804 parameters, 805 jrDataSource 806 ); 807 } 808 809 810 813 public static JasperPrint fillReport( 814 InputStream inputStream, 815 Map parameters, 816 JRDataSource jrDataSource 817 ) throws JRException 818 { 819 return JasperFillManager.fillReport( 820 inputStream, 821 parameters, 822 jrDataSource 823 ); 824 } 825 826 827 830 public static JasperPrint fillReport( 831 JasperReport jasperReport, 832 Map parameters, 833 JRDataSource jrDataSource 834 ) throws JRException 835 { 836 return JasperFillManager.fillReport( 837 jasperReport, 838 parameters, 839 jrDataSource 840 ); 841 } 842 843 844 847 public static String compileReportToFile(String sourceFileName) throws JRException 848 { 849 return JasperCompileManager.compileReportToFile(sourceFileName); 850 } 851 852 853 856 public static void compileReportToFile( 857 String sourceFileName, 858 String destFileName 859 ) throws JRException 860 { 861 JasperCompileManager.compileReportToFile( 862 sourceFileName, 863 destFileName 864 ); 865 } 866 867 868 871 public static void compileReportToFile( 872 JasperDesign jasperDesign, 873 String destFileName 874 ) throws JRException 875 { 876 JasperCompileManager.compileReportToFile( 877 jasperDesign, 878 destFileName 879 ); 880 } 881 882 883 886 public static JasperReport compileReport(String sourceFileName) throws JRException 887 { 888 return JasperCompileManager.compileReport(sourceFileName); 889 } 890 891 892 895 public static void compileReportToStream( 896 InputStream inputStream, 897 OutputStream outputStream 898 ) throws JRException 899 { 900 JasperCompileManager.compileReportToStream( 901 inputStream, 902 outputStream 903 ); 904 } 905 906 907 910 public static void compileReportToStream( 911 JasperDesign jasperDesign, 912 OutputStream outputStream 913 ) throws JRException 914 { 915 JasperCompileManager.compileReportToStream( 916 jasperDesign, 917 outputStream 918 ); 919 } 920 921 922 925 public static JasperReport compileReport(InputStream inputStream) throws JRException 926 { 927 return JasperCompileManager.compileReport(inputStream); 928 } 929 930 931 934 public static JasperReport compileReport(JasperDesign jasperDesign) throws JRException 935 { 936 return JasperCompileManager.compileReport(jasperDesign); 937 } 938 939 942 public static Collection verifyDesign(JasperDesign jasperDesign) 943 { 944 return JasperCompileManager.verifyDesign(jasperDesign); 945 } 946 947 948 951 public static JasperDesign loadDesign(String fileName) throws JRException 952 { 953 return (JasperDesign)JRLoader.loadObject(fileName); 954 } 955 956 957 960 public static JasperDesign loadDesign(InputStream inputStream) throws JRException 961 { 962 return (JasperDesign)JRLoader.loadObject(inputStream); 963 } 964 965 966 969 public static JasperDesign loadXmlDesign(String fileName) throws JRException 970 { 971 return JRXmlLoader.load(fileName); 972 } 973 974 975 978 public static JasperDesign loadXmlDesign(InputStream inputStream) throws JRException 979 { 980 return JRXmlLoader.load(inputStream); 981 } 982 983 984 987 public static JasperReport loadReport(String fileName) throws JRException 988 { 989 return (JasperReport)JRLoader.loadObject(fileName); 990 } 991 992 993 996 public static JasperReport loadReport(InputStream inputStream) throws JRException 997 { 998 return (JasperReport)JRLoader.loadObject(inputStream); 999 } 1000 1001 1002 1005 public static JasperPrint loadPrint(String fileName) throws JRException 1006 { 1007 return (JasperPrint)JRLoader.loadObject(fileName); 1008 } 1009 1010 1011 1014 public static JasperPrint loadPrint(InputStream inputStream) throws JRException 1015 { 1016 return (JasperPrint)JRLoader.loadObject(inputStream); 1017 } 1018 1019 1020} 1021 | Popular Tags |