1 28 package net.sf.jasperreports.engine; 29 30 import java.io.File ; 31 import java.io.InputStream ; 32 import java.io.OutputStream ; 33 import java.sql.Connection ; 34 import java.util.Map ; 35 36 import net.sf.jasperreports.engine.fill.JRFiller; 37 import net.sf.jasperreports.engine.util.JRLoader; 38 import net.sf.jasperreports.engine.util.JRSaver; 39 40 41 66 public class JasperFillManager 67 { 68 69 70 81 public static String fillReportToFile( 82 String sourceFileName, 83 Map parameters, 84 Connection connection 85 ) throws JRException 86 { 87 File sourceFile = new File (sourceFileName); 88 89 JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile); 90 91 File destFile = new File (sourceFile.getParent(), jasperReport.getName() + ".jrprint"); 92 String destFileName = destFile.toString(); 93 94 fillReportToFile(jasperReport, destFileName, parameters, connection); 95 96 return destFileName; 97 } 98 99 100 111 public static String fillReportToFile( 112 String sourceFileName, 113 Map parameters 114 ) throws JRException 115 { 116 File sourceFile = new File (sourceFileName); 117 118 JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile); 119 120 File destFile = new File (sourceFile.getParent(), jasperReport.getName() + ".jrprint"); 121 String destFileName = destFile.toString(); 122 123 fillReportToFile(jasperReport, destFileName, parameters); 124 125 return destFileName; 126 } 127 128 129 138 public static void fillReportToFile( 139 String sourceFileName, 140 String destFileName, 141 Map parameters, 142 Connection connection 143 ) throws JRException 144 { 145 JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFileName); 146 147 fillReportToFile(jasperReport, destFileName, parameters, connection); 148 } 149 150 151 160 public static void fillReportToFile( 161 String sourceFileName, 162 String destFileName, 163 Map parameters 164 ) throws JRException 165 { 166 JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFileName); 167 168 fillReportToFile(jasperReport, destFileName, parameters); 169 } 170 171 172 181 public static void fillReportToFile( 182 JasperReport jasperReport, 183 String destFileName, 184 Map parameters, 185 Connection connection 186 ) throws JRException 187 { 188 JasperPrint jasperPrint = fillReport(jasperReport, parameters, connection); 189 190 JRSaver.saveObject(jasperPrint, destFileName); 191 } 192 193 194 203 public static void fillReportToFile( 204 JasperReport jasperReport, 205 String destFileName, 206 Map parameters 207 ) throws JRException 208 { 209 JasperPrint jasperPrint = fillReport(jasperReport, parameters); 210 211 JRSaver.saveObject(jasperPrint, destFileName); 212 } 213 214 215 224 public static JasperPrint fillReport( 225 String sourceFileName, 226 Map parameters, 227 Connection connection 228 ) throws JRException 229 { 230 File sourceFile = new File (sourceFileName); 231 232 JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile); 233 234 return fillReport(jasperReport, parameters, connection); 235 } 236 237 238 247 public static JasperPrint fillReport( 248 String sourceFileName, 249 Map parameters 250 ) throws JRException 251 { 252 File sourceFile = new File (sourceFileName); 253 254 JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile); 255 256 return fillReport(jasperReport, parameters); 257 } 258 259 260 269 public static void fillReportToStream( 270 InputStream inputStream, 271 OutputStream outputStream, 272 Map parameters, 273 Connection connection 274 ) throws JRException 275 { 276 JasperReport jasperReport = (JasperReport)JRLoader.loadObject(inputStream); 277 278 fillReportToStream(jasperReport, outputStream, parameters, connection); 279 } 280 281 282 291 public static void fillReportToStream( 292 InputStream inputStream, 293 OutputStream outputStream, 294 Map parameters 295 ) throws JRException 296 { 297 JasperReport jasperReport = (JasperReport)JRLoader.loadObject(inputStream); 298 299 fillReportToStream(jasperReport, outputStream, parameters); 300 } 301 302 303 312 public static void fillReportToStream( 313 JasperReport jasperReport, 314 OutputStream outputStream, 315 Map parameters, 316 Connection connection 317 ) throws JRException 318 { 319 JasperPrint jasperPrint = fillReport(jasperReport, parameters, connection); 320 321 JRSaver.saveObject(jasperPrint, outputStream); 322 } 323 324 325 334 public static void fillReportToStream( 335 JasperReport jasperReport, 336 OutputStream outputStream, 337 Map parameters 338 ) throws JRException 339 { 340 JasperPrint jasperPrint = fillReport(jasperReport, parameters); 341 342 JRSaver.saveObject(jasperPrint, outputStream); 343 } 344 345 346 355 public static JasperPrint fillReport( 356 InputStream inputStream, 357 Map parameters, 358 Connection connection 359 ) throws JRException 360 { 361 JasperReport jasperReport = (JasperReport)JRLoader.loadObject(inputStream); 362 363 return fillReport(jasperReport, parameters, connection); 364 } 365 366 367 376 public static JasperPrint fillReport( 377 InputStream inputStream, 378 Map parameters 379 ) throws JRException 380 { 381 JasperReport jasperReport = (JasperReport)JRLoader.loadObject(inputStream); 382 383 return fillReport(jasperReport, parameters); 384 } 385 386 387 396 public static JasperPrint fillReport( 397 JasperReport jasperReport, 398 Map parameters, 399 Connection connection 400 ) throws JRException 401 { 402 return JRFiller.fillReport(jasperReport, parameters, connection); 403 } 404 405 406 415 public static JasperPrint fillReport( 416 JasperReport jasperReport, 417 Map parameters 418 ) throws JRException 419 { 420 return JRFiller.fillReport(jasperReport, parameters); 421 } 422 423 424 435 public static String fillReportToFile( 436 String sourceFileName, 437 Map parameters, 438 JRDataSource dataSource 439 ) throws JRException 440 { 441 File sourceFile = new File (sourceFileName); 442 443 JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile); 444 445 File destFile = new File (sourceFile.getParent(), jasperReport.getName() + ".jrprint"); 446 String destFileName = destFile.toString(); 447 448 fillReportToFile(jasperReport, destFileName, parameters, dataSource); 449 450 return destFileName; 451 } 452 453 454 463 public static void fillReportToFile( 464 String sourceFileName, 465 String destFileName, 466 Map parameters, 467 JRDataSource dataSource 468 ) throws JRException 469 { 470 JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFileName); 471 472 fillReportToFile(jasperReport, destFileName, parameters, dataSource); 473 } 474 475 476 485 public static void fillReportToFile( 486 JasperReport jasperReport, 487 String destFileName, 488 Map parameters, 489 JRDataSource dataSource 490 ) throws JRException 491 { 492 JasperPrint jasperPrint = fillReport(jasperReport, parameters, dataSource); 493 494 JRSaver.saveObject(jasperPrint, destFileName); 495 } 496 497 498 507 public static JasperPrint fillReport( 508 String sourceFileName, 509 Map parameters, 510 JRDataSource dataSource 511 ) throws JRException 512 { 513 File sourceFile = new File (sourceFileName); 514 515 JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile); 516 517 return fillReport(jasperReport, parameters, dataSource); 518 } 519 520 521 530 public static void fillReportToStream( 531 InputStream inputStream, 532 OutputStream outputStream, 533 Map parameters, 534 JRDataSource dataSource 535 ) throws JRException 536 { 537 JasperReport jasperReport = (JasperReport)JRLoader.loadObject(inputStream); 538 539 fillReportToStream(jasperReport, outputStream, parameters, dataSource); 540 } 541 542 543 552 public static void fillReportToStream( 553 JasperReport jasperReport, 554 OutputStream outputStream, 555 Map parameters, 556 JRDataSource dataSource 557 ) throws JRException 558 { 559 JasperPrint jasperPrint = fillReport(jasperReport, parameters, dataSource); 560 561 JRSaver.saveObject(jasperPrint, outputStream); 562 } 563 564 565 574 public static JasperPrint fillReport( 575 InputStream inputStream, 576 Map parameters, 577 JRDataSource dataSource 578 ) throws JRException 579 { 580 JasperReport jasperReport = (JasperReport)JRLoader.loadObject(inputStream); 581 582 return fillReport(jasperReport, parameters, dataSource); 583 } 584 585 586 595 public static JasperPrint fillReport( 596 JasperReport jasperReport, 597 Map parameters, 598 JRDataSource dataSource 599 ) throws JRException 600 { 601 return JRFiller.fillReport(jasperReport, parameters, dataSource); 602 } 603 604 605 } 606 | Popular Tags |