Java 类net.sf.jasperreports.engine.util.JRSaver 实例源码

项目:jasperreports    文件:SaveAction.java   
@Override
    public void performAction() 
    {
//      JasperDesign jasperDesign = getJasperDesign();
        JasperDesignCache cache = JasperDesignCache.getInstance(getJasperReportsContext(), getReportContext());
        Map<String, JasperDesignReportResource> cachedResources = cache.getCachedResources();
        for (String uri : cachedResources.keySet())
        {
            JasperDesignReportResource resource = cachedResources.get(uri);
            JasperDesign jasperDesign = resource.getJasperDesign();
            if (jasperDesign != null)
            {
                JasperReport jasperReport = resource.getReport();
                String appRealPath = null;//FIXMECONTEXT WebFileRepositoryService.getApplicationRealPath();
                try
                {
                    JRSaver.saveObject(jasperReport, new File(new File(new File(appRealPath), "WEB-INF/repository"), uri));//FIXMEJIVE harcoded
                }
                catch (JRException e)
                {
                    throw new JRRuntimeException(e);
                }
            }
        }
    }
项目:jasperreports    文件:JRPrintSaveContributor.java   
@Override
public void save(JasperPrint jasperPrint, File file) throws JRException
{
    if (!file.getName().toLowerCase().endsWith(EXTENSION_JRPRINT))
    {
        file = new File(file.getAbsolutePath() + EXTENSION_JRPRINT);
    }

    if (
        !file.exists() ||
        JOptionPane.OK_OPTION == 
            JOptionPane.showConfirmDialog(
                null, 
                MessageFormat.format(
                    getBundleString("file.exists"),
                    new Object[]{file.getName()}
                    ), 
                getBundleString("save"), 
                JOptionPane.OK_CANCEL_OPTION
                )
        )
    {
        JRSaver.saveObject(jasperPrint, file);
    }
}
项目:jasperreports    文件:JRAbstractCompiler.java   
protected File getSourceFile(File saveSourceDir, String unitName, JRCompilationSourceCode sourceCode)
{
    File sourceFile = null;
    if (saveSourceDir != null && sourceCode != null && sourceCode.getCode() != null)
    {
        String fileName = getSourceFileName(unitName);
        sourceFile = new File(saveSourceDir,  fileName);

        try
        {
            JRSaver.saveClassSource(sourceCode.getCode(), sourceFile);
        }
        catch (JRException e)
        {
            throw new JRRuntimeException(e);
        }
    }
    return sourceFile;
}
项目:jasperreports    文件:JasperFillManager.java   
/**
 * Fills the compiled report design loaded from the specified file.
 * The result of this operation is another file that will contain the serialized  
 * {@link JasperPrint} object representing the generated document,
 * having the same name as the report design as declared in the source file, 
 * plus the <code>*.jrprint</code> extension, located in the same directory as the source file. 
 * 
 * @param sourceFileName source file containing the compile report design
 * @param params     report parameters map
 * @param connection     JDBC connection object to use for executing the report internal SQL query
 */
public String fillToFile(
    String sourceFileName, 
    Map<String,Object> params,
    Connection connection
    ) throws JRException
{
    File sourceFile = new File(sourceFileName);

    JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile);

    File destFile = new File(sourceFile.getParent(), jasperReport.getName() + ".jrprint");
    String destFileName = destFile.toString();

    JasperReportsContext lcJrCtx = getLocalJasperReportsContext(sourceFile);

    JasperPrint jasperPrint = JRFiller.fill(lcJrCtx, jasperReport, params, connection);

    JRSaver.saveObject(jasperPrint, destFileName);

    return destFileName;
}
项目:jasperreports    文件:JasperFillManager.java   
/**
 * Fills the compiled report design loaded from the specified file.
 * The result of this operation is another file that will contain the serialized  
 * {@link JasperPrint} object representing the generated document,
 * having the same name as the report design as declared in the source file, 
 * plus the <code>*.jrprint</code> extension, located in the same directory as the source file. 
 * 
 * @param sourceFileName source file containing the compile report design
 * @param params     report parameters map
 * @see JRFiller#fill(JasperReportsContext, JasperReport, Map)
 */
public String fillToFile(
    String sourceFileName, 
    Map<String,Object> params
    ) throws JRException
{
    File sourceFile = new File(sourceFileName);

    JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile);

    File destFile = new File(sourceFile.getParent(), jasperReport.getName() + ".jrprint");
    String destFileName = destFile.toString();

    JasperReportsContext lcJrCtx = getLocalJasperReportsContext(sourceFile);

    JasperPrint jasperPrint = JRFiller.fill(lcJrCtx, jasperReport, params);

    JRSaver.saveObject(jasperPrint, destFileName);

    return destFileName;
}
项目:jasperreports    文件:JasperFillManager.java   
/**
 * Fills the compiled report design loaded from the file received as the first parameter
 * and places the result in the file specified by the second parameter.
 * 
 * @param sourceFileName source file containing the compile report design
 * @param destFileName   file name to place the generated report into
 * @param params     report parameters map
 * @param connection     JDBC connection object to use for executing the report internal SQL query
 */
public void fillToFile(
    String sourceFileName, 
    String destFileName, 
    Map<String,Object> params,
    Connection connection
    ) throws JRException
{
    File sourceFile = new File(sourceFileName);

    JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile);

    JasperReportsContext lcJrCtx = getLocalJasperReportsContext(sourceFile);

    JasperPrint jasperPrint = JRFiller.fill(lcJrCtx, jasperReport, params, connection);

    JRSaver.saveObject(jasperPrint, destFileName);
}
项目:jasperreports    文件:JasperFillManager.java   
/**
 * Fills the compiled report design loaded from the file received as the first parameter
 * and places the result in the file specified by the second parameter.
 * 
 * @param sourceFileName source file containing the compile report design
 * @param destFileName   file name to place the generated report into
 * @param params     report parameters map
 * @see JRFiller#fill(JasperReportsContext, JasperReport, Map)
 */
public void fillToFile(
    String sourceFileName, 
    String destFileName, 
    Map<String,Object> params
    ) throws JRException
{
    File sourceFile = new File(sourceFileName);

    JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile);

    JasperReportsContext lcJrCtx = getLocalJasperReportsContext(sourceFile);

    JasperPrint jasperPrint = JRFiller.fill(lcJrCtx, jasperReport, params);

    JRSaver.saveObject(jasperPrint, destFileName);
}
项目:jasperreports    文件:JasperFillManager.java   
/**
 * Fills the compiled report design loaded from the specified file.
 * The result of this operation is another file that will contain the serialized  
 * {@link JasperPrint} object representing the generated document,
 * having the same name as the report design as declared in the source file, 
 * plus the <code>*.jrprint</code> extension, located in the same directory as the source file. 
 * 
 * @param sourceFileName source file containing the compile report design
 * @param params     report parameters map
 * @param dataSource     data source object
 */
public String fillToFile(
    String sourceFileName, 
    Map<String,Object> params,
    JRDataSource dataSource
    ) throws JRException
{
    File sourceFile = new File(sourceFileName);

    JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile);

    File destFile = new File(sourceFile.getParent(), jasperReport.getName() + ".jrprint");
    String destFileName = destFile.toString();

    JasperReportsContext lcJrCtx = getLocalJasperReportsContext(sourceFile);

    JasperPrint jasperPrint = JRFiller.fill(lcJrCtx, jasperReport, params, dataSource);

    JRSaver.saveObject(jasperPrint, destFileName);

    return destFileName;
}
项目:jasperreports    文件:JasperFillManager.java   
/**
 * Fills the compiled report design loaded from the file received as the first parameter
 * and places the result in the file specified by the second parameter.
 * 
 * @param sourceFileName source file containing the compile report design
 * @param destFileName   file name to place the generated report into
 * @param params     report parameters map
 * @param dataSource     data source object
 */
public void fillToFile(
    String sourceFileName, 
    String destFileName, 
    Map<String,Object> params,
    JRDataSource dataSource
    ) throws JRException
{
    File sourceFile = new File(sourceFileName);

    JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile);

    JasperReportsContext lcJrCtx = getLocalJasperReportsContext(sourceFile);

    JasperPrint jasperPrint = JRFiller.fill(lcJrCtx, jasperReport, params, dataSource);

    JRSaver.saveObject(jasperPrint, destFileName);
}
项目:omr    文件:JazzJasperTypeCreator.java   
public void writeObject(Object object, MessageWriter writer, Context context) throws DatabindingException {

        if (object == null || !(object instanceof JasperReport))
            throw new DatabindingException("Erro ao tentar converter JasperReport para array de bytes!");

        JasperReport jasperReport = (JasperReport) object;

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            JRSaver.saveObject(jasperReport, baos);
        } catch (JRException e) {
            throw new DatabindingException("Erro ao tentar salvar arquivo jasper para byte array!", e);
        }

        super.writeObject(baos.toByteArray(), writer, context);  
    }
项目:omr    文件:JazzJasperTypeCreator.java   
public void writeObject(Object object, MessageWriter writer, Context context) throws DatabindingException {

        if (object == null || !(object instanceof JasperReport))
            throw new DatabindingException("Erro ao tentar converter JasperReport para array de bytes!");

        JasperReport jasperReport = (JasperReport) object;

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            JRSaver.saveObject(jasperReport, baos);
        } catch (JRException e) {
            throw new DatabindingException("Erro ao tentar salvar arquivo jasper para byte array!", e);
        }

        super.writeObject(baos.toByteArray(), writer, context);  
    }
项目:PDFReporter-Studio    文件:ExportAsJasperReportsAction.java   
@Override
protected void exportWithProgress(File file, JRExportProgressMonitor monitor) throws Throwable {
    final java.io.File f = file.getAbsoluteFile();
    final Throwable[] ex = new Throwable[1];
    BusyIndicator.showWhile(null, new Runnable() {
        public void run() {
            try {
                JRSaver.saveObject(getReportViewer().getReport(), f);
            } catch (Throwable e) {
                ex[0] = e;
            }
        }
    });
    if (ex[0] != null)
        throw ex[0];
}
项目:gnvc-ims    文件:ReportGenerator.java   
/**
 * Compile Template Design and produce .jasper file
 *
 * @throws IDXReportException
 */
private void compileToFile() {
    try {
        log.info("JRXML_FILE:" + JRXML_FILENAME);
        setJasperDesign(JRXmlLoader.load(new FileInputStream(JRXML_FILENAME)));

        /*
         * JasperDesign design = JRXmlLoader.load(
        new LegacyJasperInputStream(new FileInputStream("MyXsdBasedDesign.jrxml"))
        );

         */
        if (getJasperDesign() == null) {
            log.error("jasper design is null");
        }
        setJasperReport(JasperCompileManager.compileReport(getJasperDesign()));
        JRSaver.saveObject(getJasperReport(), JASPER_FILENAME);
    } catch (FileNotFoundException ex) {
        log.error(ex);
    } catch (JRException jre) {
        jre.printStackTrace();
    }
}
项目:gnvc-ims    文件:ReportGenerator.java   
private void compileToFile(InputStream is) {
    try {
        setJasperDesign(JRXmlLoader.load(is));

        /*
         * JasperDesign design = JRXmlLoader.load(
        new LegacyJasperInputStream(new FileInputStream("MyXsdBasedDesign.jrxml"))
        );

         */
        if (getJasperDesign() == null) {
            log.error("jasper design is null");
        }
        Boolean compileStatus = compileSubReport();
        if(!compileStatus)
            log.error("subreport compilation failed");
        setJasperReport(JasperCompileManager.compileReport(getJasperDesign()));
        JRSaver.saveObject(getJasperReport(), JASPER_FILENAME);
    } catch (JRException jre) {
        jre.printStackTrace();
    }
}
项目:VaadinUtils    文件:JasperReportCompiler.java   
public JasperReport compileReport( final File sourcePath, final File outputPath,
        String reportName) throws Throwable
{
    String name = reportName;
    if (!name.contains(".jasper"))
    {
        name = name+".jasper";
    }
    JasperReport jasperReport = null;
    JasperDesign jasperDesign = getDesignFile(sourcePath, reportName);
    File outputReport = new File(outputPath.getAbsolutePath() + "/" + name);
    jasperReport = JasperCompileManager.compileReport(jasperDesign);
    JRSaver.saveObject(jasperReport, outputReport);
    logger.warn("Saving compiled report : " + outputReport.getName());

    // Compile sub reports
    JRElementsVisitor.visitReport(jasperReport, createVisitor(sourcePath, outputPath));

    if (subReportException != null)
        throw new RuntimeException(subReportException);
    return jasperReport;
}
项目:VaadinUtils    文件:JasperReportCompiler.java   
public JasperReport compileReport(JasperDesign jasperDesign, final File sourcePath, final File outputPath,
        String reportName) throws Throwable
{
    JasperReport jasperReport = null;
    File outputReport = new File(outputPath.getAbsolutePath() + "/" + reportName + ".jasper");
    jasperReport = JasperCompileManager.compileReport(jasperDesign);
    JRSaver.saveObject(jasperReport, outputReport);
    logger.warn("Saving compiled report : " + outputReport.getAbsolutePath());

    // Compile sub reports
    JRElementsVisitor.visitReport(jasperReport, createVisitor(sourcePath, outputPath));

    if (subReportException != null)
        throw new RuntimeException(subReportException);
    return jasperReport;
}
项目:jasperreports    文件:PrintServiceApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperPrint jasperPrint = getJasperPrint();
    JRSaver.saveObject(jasperPrint, "build/reports/PrintServiceReport.jrprint");
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:NoReportApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperPrint jasperPrint = getJasperPrint();
    JRSaver.saveObject(jasperPrint, "build/reports/NoReport.jrprint");
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:JasperCompileManager.java   
/**
 * Compiles the report design object received as the first parameter, placing the result 
 * in the file specified by the second parameter.
 * The resulting file will contain a serialized instance of a 
 * {@link net.sf.jasperreports.engine.JasperReport} object representing the compiled report design.
 * 
 * @param jasperDesign source report design object
 * @param destFileName file name to place the compiled report design into
 */
public void compileToFile(
    JasperDesign jasperDesign,
    String destFileName
    ) throws JRException
{
    JasperReport jasperReport = compile(jasperDesign);

    JRSaver.saveObject(jasperReport, destFileName);
}
项目:jasperreports    文件:JasperCompileManager.java   
/**
 * Compiles the report design object represented by the first parameter and
 * writes the generated compiled report design object to the output stream specified 
 * by the second parameter.
 * 
 * @param jasperDesign source report design object
 * @param outputStream output stream to write the compiled report design to
 */
public void compileToStream(
    JasperDesign jasperDesign,
    OutputStream outputStream
    ) throws JRException
{
    JasperReport jasperReport = compile(jasperDesign);

    JRSaver.saveObject(jasperReport, outputStream);
}
项目:jasperreports    文件:JasperFillManager.java   
/**
 * Fills the compiled report design received as the first parameter
 * and places the result in the file specified by the second parameter.
 * 
 * @param jasperReport compiled report design object to use for filling
 * @param destFileName file name to place the generated report into
 * @param parameters   report parameters map
 * @param connection   JDBC connection object to use for executing the report internal SQL query
 */
public void fillToFile(
    JasperReport jasperReport, 
    String destFileName, 
    Map<String,Object> parameters,
    Connection connection
    ) throws JRException
{
    JasperPrint jasperPrint = fill(jasperReport, parameters, connection);

    JRSaver.saveObject(jasperPrint, destFileName);
}
项目:jasperreports    文件:JasperFillManager.java   
/**
 * Fills the compiled report design received as the first parameter
 * and places the result in the file specified by the second parameter.
 * 
 * @param jasperReport compiled report design object to use for filling
 * @param destFileName file name to place the generated report into
 * @param parameters   report parameters map
 * @see JRFiller#fill(JasperReportsContext, JasperReport, Map)
 */
public void fillToFile(
    JasperReport jasperReport, 
    String destFileName, 
    Map<String,Object> parameters
    ) throws JRException
{
    JasperPrint jasperPrint = fill(jasperReport, parameters);

    JRSaver.saveObject(jasperPrint, destFileName);
}
项目:jasperreports    文件:JasperFillManager.java   
/**
 * Fills the compiled report design supplied as the first parameter and writes
 * the generated report object to the output stream specified by the second parameter.
 * 
 * @param jasperReport compiled report design object to use for filling
 * @param outputStream output stream to write the generated report object to
 * @param parameters   report parameters map
 * @param connection   JDBC connection object to use for executing the report internal SQL query
 */
public void fillToStream(
    JasperReport jasperReport, 
    OutputStream outputStream, 
    Map<String,Object> parameters,
    Connection connection
    ) throws JRException
{
    JasperPrint jasperPrint = fill(jasperReport, parameters, connection);

    JRSaver.saveObject(jasperPrint, outputStream);
}
项目:jasperreports    文件:JasperFillManager.java   
/**
 * Fills the compiled report design supplied as the first parameter and writes
 * the generated report object to the output stream specified by the second parameter.
 * 
 * @param jasperReport compiled report design object to use for filling
 * @param outputStream output stream to write the generated report object to
 * @param parameters   report parameters map
 * @see JRFiller#fill(JasperReportsContext, JasperReport, Map)
 */
public void fillToStream(
    JasperReport jasperReport, 
    OutputStream outputStream, 
    Map<String,Object> parameters
    ) throws JRException
{
    JasperPrint jasperPrint = fill(jasperReport, parameters);

    JRSaver.saveObject(jasperPrint, outputStream);
}
项目:jasperreports    文件:JasperFillManager.java   
/**
 * Fills the compiled report design received as the first parameter
 * and places the result in the file specified by the second parameter.
 * 
 * @param jasperReport compiled report design object to use for filling
 * @param destFileName file name to place the generated report into
 * @param parameters   report parameters map
 * @param dataSource   data source object
 */
public void fillToFile(
    JasperReport jasperReport, 
    String destFileName, 
    Map<String,Object> parameters,
    JRDataSource dataSource
    ) throws JRException
{
    JasperPrint jasperPrint = fill(jasperReport, parameters, dataSource);

    JRSaver.saveObject(jasperPrint, destFileName);
}
项目:jasperreports    文件:JasperFillManager.java   
/**
 * Fills the compiled report design supplied as the first parameter and writes
 * the generated report object to the output stream specified by the second parameter.
 * 
 * @param jasperReport compiled report design object to use for filling
 * @param outputStream output stream to write the generated report object to
 * @param parameters   report parameters map
 * @param dataSource   data source object
 */
public void fillToStream(
    JasperReport jasperReport, 
    OutputStream outputStream, 
    Map<String,Object> parameters,
    JRDataSource dataSource
    ) throws JRException
{
    JasperPrint jasperPrint = fill(jasperReport, parameters, dataSource);

    JRSaver.saveObject(jasperPrint, outputStream);
}
项目:jasperstarter    文件:Report.java   
private void compile() throws JRException {
    jasperReport = JasperCompileManager.compileReport(jasperDesign);
    // this option is only available if command process is active
    if (config.isWriteJasper()) {
        String inputBasename = inputFile.getName().split("\\.(?=[^\\.]+$)")[0];
        String outputDir = inputFile.getParent();
        File outputFile = new File(outputDir + "/" + inputBasename + ".jasper");
        JRSaver.saveObject(jasperReport, outputFile);
    }
}
项目:jasperstarter    文件:Report.java   
public void compileToFile() {
    if (initialInputType == InputType.JASPER_DESIGN) {
        try {
            JRSaver.saveObject(jasperReport, this.output.getAbsolutePath() + ".jasper");
        } catch (JRException ex) {
            throw new IllegalArgumentException("outputFile" + this.output.getAbsolutePath() + ".jasper" + "could not be written");
        }
    } else {
        throw new IllegalArgumentException("input file: \"" + inputFile + "\" is not a valid jrxml file");
    }
}
项目:dwoss    文件:SalesListingProducerOperation.java   
/**
 *
 * @param name the fileName in the jar, but without jrxml
 * @return
 */
private String compileReportToTempFile(final String name) {
    // Optimize, only do it on updates.
    String reportFile = TempUtil.getDirectory("jasper") + "/" + name + ".jasper";
    URL url = Objects.requireNonNull(getClass().getResource(name + ".jrxml"), "The Resource " + getClass().getPackage() + "/" + name + ".jrxml not found.");
    try (InputStream is = url.openStream()) {
        JRSaver.saveObject(JasperCompileManager.compileReport(is), reportFile);
        return reportFile;
    } catch (IOException | JRException ex) {
        throw new RuntimeException(ex);
    }
}
项目:gnvc-ims    文件:ReportGenerator.java   
/**
 * Filling compiled report template and store JasperPrint Object to file.
 *
 * @param dest
 *            Destination path and file name.
 *
 */
protected void fillReportToFile(String dest) {
    if (null == getJasperPrint()) {
        fillReport();
    }

    try {
        JRSaver.saveObject(getJasperPrint(), dest);
    } catch (JRException jre) {
        jre.printStackTrace();
    }
}
项目:dynamicreports-jasper    文件:AbstractJasperTest.java   
private JasperPrint serializableTest(JasperPrint jasperPrint) throws IOException, JRException {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    JRSaver.saveObject(jasperPrint, bos);
    bos.flush();
    bos.close();

   InputStream stream = new ByteArrayInputStream(bos.toByteArray());
   return (JasperPrint) JRLoader.loadObject(stream);
}
项目:PDFReporter-Studio    文件:ModelUtils.java   
public static JasperDesign copyJasperDesign(JasperReportsContext jContext, JasperDesign jrd) throws JRException {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    JRSaver.saveObject(jrd, out);
    JasperDesign jd = (JasperDesign) JRLoader.loadObject(jContext, new ByteArrayInputStream(out.toByteArray()));
    return jd;
}
项目:PDFReporter-Studio    文件:JasperReportsBuilder.java   
public IFile compileJRXML(IResource resource, IProgressMonitor monitor) throws CoreException {
    if (!(resource instanceof IFile && resource.exists() && resource.getFileExtension() != null))
        return null;
    IProject project = resource.getProject();
    IPath outLocation = outmap.get(project);
    if (outLocation != null && project.hasNature(JavaCore.NATURE_ID))
        outLocation = JavaCore.create(project).getOutputLocation();
    if (outLocation != null && outLocation.isPrefixOf(resource.getFullPath()))
        return null;
    if (resource.getFileExtension().equals(FileExtension.JRXML)) {
        long stime = System.currentTimeMillis();
        ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
        IFile destFile = null;
        try {
            monitor.subTask("Compiling " + resource.getFullPath().toOSString());
            Markers.deleteMarkers(resource);
            IFile file = (IFile) resource;
            ClassLoader cl = clmap.get(project);
            if (cl == null) {
                cl = ClassLoaderUtil.getClassLoader4Project(SubMonitor.convert(monitor), project);
                jContext.setClassLoader(cl);
                clmap.put(project, cl);
            }
            Thread.currentThread().setContextClassLoader(cl);
            reportCompiler.setErrorHandler(getErrorHandler(file));
            destFile = FileExtension.getCompiledFile(file);

            JasperReport jasperReport = null;
            // Checks if a potential linked resource really exists
            if (file.getLocation().toFile().exists())
                jasperReport = reportCompiler.compileReport(jContext, file);

            if (jasperReport == null) {
                if (destFile.exists())
                    destFile.delete(true, false, SubMonitor.convert(monitor));
            } else {
                ByteArrayOutputStream bout = new ByteArrayOutputStream();
                ByteArrayInputStream compiledInput = null;
                try {
                    JRSaver.saveObject(jasperReport, bout);
                    compiledInput = new ByteArrayInputStream(bout.toByteArray());
                    if (destFile.exists()) {
                        if (file.isLinked() && !destFile.isLinked()) {
                            destFile.delete(true, false, SubMonitor.convert(monitor));
                            destFile = createDestFile(monitor, project, file, destFile, compiledInput);
                        } else
                            destFile.setContents(compiledInput, true, false, SubMonitor.convert(monitor));
                    } else
                        destFile = createDestFile(monitor, project, file, destFile, compiledInput);
                    if (!destFile.isDerived())
                        destFile.setDerived(true, SubMonitor.convert(monitor));
                } catch (JRException e) {
                    throw new RuntimeException(e);// TODO
                } finally {
                    FileUtils.closeStream(bout);
                    FileUtils.closeStream(compiledInput);
                }
            }
        } finally {
            Thread.currentThread().setContextClassLoader(oldLoader);
        }
        long etime = System.currentTimeMillis();
        System.out.println(resource.getFullPath().toOSString() + " " + (etime - stime) + " ms");
        return destFile;
    } else if (resource.getFileExtension().equals(FileExtension.JASPER)) {
        return compileJRXML(FileExtension.getSourceFile((IFile) resource), monitor);
    }
    return null;
}
项目:omr    文件:JasperSaver.java   
/**
 * @param args
 * @throws JRException 
 * @throws FileNotFoundException 
 */
public static void main(String[] args) throws JRException, FileNotFoundException {

    String url = "C:\\darcio\\trabalho\\workspace\\modulesOMR\\trunk\\JazzOMRParser\\parser\\testeCorrectionWS\\WSTestKit\\ExamReportDSP2.jrxml";

    FileInputStream fis = new FileInputStream(url);

    //InputStream stream = JasperSaver.class.getResourceAsStream("/reports/imgReport.jrxml");

    JasperReport jasperReport = JasperCompileManager.compileReport(fis);

    JRSaver.saveObject(jasperReport, "ExamReportDSP2.jasper");

}
项目:omr    文件:JasperSaver.java   
/**
 * @param args
 * @throws JRException 
 */
public static void main(String[] args) throws JRException {

    InputStream stream = JasperSaver.class.getResourceAsStream("/reports/ExamReportDSP2.jrxml");

    JasperReport jasperReport = JasperCompileManager.compileReport(stream);

    JRSaver.saveObject(jasperReport, "ExamReportDSP2.jasper");

}