本文整理汇总了Java中fr.opensagres.xdocreport.core.XDocReportException类的典型用法代码示例。如果您正苦于以下问题:Java XDocReportException类的具体用法?Java XDocReportException怎么用?Java XDocReportException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XDocReportException类属于fr.opensagres.xdocreport.core包,在下文中一共展示了XDocReportException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: preprocessTemplate
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
/**
* Charge les templates
*/
public void preprocessTemplate() {
try {
logger.info("Generation du report");
// InputStream in = getClass().getResourceAsStream("/template/"+ConstanteUtils.TEMPLATE_DOSSIER+ConstanteUtils.TEMPLATE_EXTENSION);
InputStream in = MethodUtils.getXDocReportTemplate(ConstanteUtils.TEMPLATE_DOSSIER, null, null);
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(in, TemplateEngineKind.Velocity);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Options options = Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.XWPF);
IContext context = report.createContext();
report.convert(context, options, out);
out.close();
in.close();
} catch (IOException | XDocReportException e) {
logger.error("Erreur a la generation du report", e);
}
}
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:20,代码来源:LaunchAppConfig.java
示例2: doEntries
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
private void doEntries( HttpServletRequest request, HttpServletResponse response )
throws ServletException, IOException
{
try
{
IXDocReport report = super.getReport( request );
if ( report != null )
{
XDocArchive archive = report.getPreprocessedDocumentArchive();
request.setAttribute( XDOC_ARCHIVE, archive );
request.setAttribute( PREPROCESSED, report.isPreprocessed() );
}
}
catch ( XDocReportException e )
{
throw new ServletException( e );
}
request.getRequestDispatcher( DOCUMENT_ARCHIVE_JSP ).forward( request, response );
}
开发者ID:DistX,项目名称:Learning,代码行数:20,代码来源:ProcessXDocReportServlet.java
示例3: populateContext
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
@Override
protected void populateContext( IContext context, String reportId, HttpServletRequest req )
throws XDocReportException
{
String project = req.getParameter( "project" );
context.put( "project", project );
String url = req.getParameter( "url" );
context.put( "url", url );
String comments_html = req.getParameter( "comments_html" );
context.put( "comments_html", comments_html );
String comments_gwiki = req.getParameter( "comments_gwiki" );
context.put( "comments_gwiki", comments_gwiki );
String comments_mediawiki = req.getParameter( "comments_mediawiki" );
context.put( "comments_mediawiki", comments_mediawiki );
}
开发者ID:DistX,项目名称:Learning,代码行数:17,代码来源:TextStylingReportServlet.java
示例4: doDownload
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
private void doDownload( HttpServletRequest request, HttpServletResponse response )
throws IOException, ServletException
{
String reportId = getReportId( request );
if ( StringUtils.isNotEmpty( reportId ) )
{
DefaultReportController defaultReport = DefaultReportRegistry.INSTANCE.getReportController( reportId );
if ( defaultReport != null )
{
// Get mime mapping
MimeMapping mimeMapping = null;
try
{
mimeMapping = XDocReportRegistry.getRegistry().getMimeMapping( defaultReport.getFileExtension() );
}
catch ( XDocReportException e )
{
}
prepareHTTPResponse( reportId, mimeMapping, request, response );
IOUtils.copy( defaultReport.getSourceStream(), response.getOutputStream() );
}
}
}
开发者ID:DistX,项目名称:Learning,代码行数:24,代码来源:LoadXDocReportServlet.java
示例5: generatePdfAsByteArray
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
public synchronized byte[] generatePdfAsByteArray(Resource resource, Map<String, Object> contextMap) throws PDFGenerationException {
try {
final IXDocReport report = xDocReportRegistry.loadReport(resource.getInputStream(), TemplateEngineKind.Freemarker);
final IContext context = report.createContext();
context.putMap(contextMap);
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
final Options options = Options.getTo(PDF).via(XWPF);
report.convert(context, options, byteArrayOutputStream);
return byteArrayOutputStream.toByteArray();
} catch (IOException | XDocReportException e) {
throw new PDFGenerationException(e);
}
}
开发者ID:cegeka,项目名称:batchers,代码行数:17,代码来源:PDFGeneratorService.java
示例6: export
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
public byte[] export(InputStream template, Map<String, Object> arguments) {
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(template, TemplateEngineKind.Velocity);
IContext context = report.createContext(arguments);
report.process(context, out);
return out.toByteArray();
} catch (XDocReportException | IOException ex) {
throw new GeneralException(ex);
}
}
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:14,代码来源:DocxExporter.java
示例7: getSourceStream
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
@Override
protected InputStream getSourceStream( String reportId, HttpServletRequest request )
throws IOException, XDocReportException
{
if ( ODT_PROJECT_WITH_VELOCITY_LIST.equals( reportId ) )
{
return Data.class.getResourceAsStream( "ODTProjectWithVelocityList.odt" );
}
if ( DOCX_PROJECT_WITH_VELOCITY_LIST.equals( reportId ) )
{
return Data.class.getResourceAsStream("DocxProjectWithVelocityList.docx" );
}
throw new XDocReportNotFoundException( reportId );
}
开发者ID:DistX,项目名称:Learning,代码行数:15,代码来源:MyReportServlet.java
示例8: populateContext
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
@Override
protected void populateContext( IContext context, String reportId, HttpServletRequest request )
throws XDocReportException
{
if ( ODT_PROJECT_WITH_VELOCITY_LIST.equals( reportId ) || DOCX_PROJECT_WITH_VELOCITY_LIST.equals( reportId ) )
{
String name = request.getParameter( "name" );
Project project = new Project( name );
context.put( "project", project );
int nbDevelopers = 0;
try
{
nbDevelopers = Integer.parseInt( request.getParameter( "nbDevelopers" ) );
}
catch ( Throwable e )
{
}
List<Developer> developers = new ArrayList<Developer>( nbDevelopers );
for ( int i = 0; i < nbDevelopers; i++ )
{
developers.add( new Developer( "Name" + i, "LastName" + i, "Mail" + i ) );
}
context.put( "developers", developers );
}
else
{
throw new XDocReportNotFoundException( reportId );
}
}
开发者ID:DistX,项目名称:Learning,代码行数:32,代码来源:MyReportServlet.java
示例9: doLoad
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
private void doLoad( HttpServletRequest request, HttpServletResponse response )
throws ServletException, IOException
{
try
{
registerReportInfos( getReportId( request ), request );
}
catch ( XDocReportException e )
{
throw new ServletException( e );
}
request.getRequestDispatcher( PROCESSREPORT_JSP ).forward( request, response );
}
开发者ID:DistX,项目名称:Learning,代码行数:14,代码来源:ProcessXDocReportServlet.java
示例10: getReport
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
@Override
protected IXDocReport getReport( HttpServletRequest request )
throws IOException, XDocReportException
{
IXDocReport report = super.getReport( request );
if ( report != null )
{
registerReportInfos( report.getId(), request );
}
return report;
}
开发者ID:DistX,项目名称:Learning,代码行数:12,代码来源:ProcessXDocReportServlet.java
示例11: loadReport
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
@Override
protected IXDocReport loadReport( String reportId, XDocReportRegistry registry, HttpServletRequest request )
throws IOException, XDocReportException
{
IXDocReport report = super.loadReport( reportId, registry, request );
report.setData( LOADED_REPORT_DATE_KEY, Calendar.getInstance().getTime() );
return report;
}
开发者ID:DistX,项目名称:Learning,代码行数:9,代码来源:ProcessXDocReportServlet.java
示例12: getConverterTypeFrom
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
private String getConverterTypeFrom( IXDocReport report, String reportId, HttpServletRequest request )
throws IOException, XDocReportException
{
if ( report != null )
{
return report.getKind();
}
return getConverterTypeFrom( reportId, request );
}
开发者ID:DistX,项目名称:Learning,代码行数:10,代码来源:ProcessXDocReportServlet.java
示例13: getSourceStream
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
@Override
protected InputStream getSourceStream( String reportId, HttpServletRequest request )
throws IOException, XDocReportException
{
if ( getReportId( request ).toLowerCase().endsWith( "odt" ) )
{
return TextStylingReportServlet.class.getResourceAsStream( "TextStyling.odt" );
}
return TextStylingReportServlet.class.getResourceAsStream( "TextStyling.docx" );
}
开发者ID:DistX,项目名称:Learning,代码行数:11,代码来源:TextStylingReportServlet.java
示例14: getSourceStream
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
@Override
protected InputStream getSourceStream( String reportId, HttpServletRequest request )
throws IOException, XDocReportException
{
if ( ODT_HELLO_WORD_WITH_VELOCITY.equals( reportId ) )
{
// reportId = ODTHelloWorldWithVelocity, returns stream of the ODT
return HelloWorldReportServlet.class.getResourceAsStream( "ODTHelloWorldWithVelocity.odt" );
}
throw new XDocReportNotFoundException( reportId );
}
开发者ID:DistX,项目名称:Learning,代码行数:12,代码来源:HelloWorldReportServlet.java
示例15: populateContext
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
@Override
protected void populateContext( IContext context, String reportId, HttpServletRequest req )
throws XDocReportException
{
if ( reportId.equals( ODT_HELLO_WORD_WITH_VELOCITY ) )
{
// reportId = ODTHelloWorldWithVelocity, prepare context with name
String name = req.getParameter( "name" );
context.put( "name", name );
}
else
{
throw new XDocReportNotFoundException( reportId );
}
}
开发者ID:DistX,项目名称:Learning,代码行数:16,代码来源:HelloWorldReportServlet.java
示例16: doLoad
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
private void doLoad( HttpServletRequest request, HttpServletResponse response )
throws ServletException, IOException
{
ITemplateEngine templateEngine = null;
String reportId = getReportId( request );
IXDocReport report = getRegistryFromHTTPSession( request ).getReport( reportId );
if ( report != null )
{
templateEngine = getTemplateEngine( report, request );
if ( templateEngine != null )
{
MetaDataModel extractor = new MetaDataModel();
try
{
report.setCacheOriginalDocument( true );
report.setTemplateEngine( templateEngine );
report.preprocess();
report.extractFields( extractor );
report.setData( DATA_MODEL_REPORT_KEY, extractor );
}
catch ( XDocReportException e )
{
throw new ServletException( e );
}
}
}
super.doForward( report, request, response );
}
开发者ID:DistX,项目名称:Learning,代码行数:29,代码来源:LoadXDocReportServlet.java
示例17: doSave
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
private void doSave( HttpServletRequest request, HttpServletResponse response )
throws IOException, ServletException
{
ITemplateEngine templateEngine = null;
String reportId = getReportId( request );
IXDocReport report = getRegistryFromHTTPSession( request ).getReport( reportId );
boolean reportTmp = report != null;
if ( report == null )
{
report = getRegistry( request ).getReport( reportId );
}
if ( report != null )
{
templateEngine = getTemplateEngine( report, request );
if ( templateEngine != null )
{
report.setTemplateEngine( templateEngine );
updateMetaDataModel( report, request );
if ( reportTmp )
{
// Clear registry from HTTP session
super.clearRegistryFromHTTPSession( request );
// Mark as saved report
report.setData( SAVED_REPORT_KEY, true );
report.setData( LOADED_REPORT_DATE_KEY, Calendar.getInstance().getTime() );
try
{
// Register the report in global registry
getRegistry( request ).registerReport( report );
}
catch ( XDocReportException e )
{
throw new ServletException( e );
}
}
}
}
super.doForward( report, request, response );
}
开发者ID:DistX,项目名称:Learning,代码行数:40,代码来源:LoadXDocReportServlet.java
示例18: getSourceStream
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
@Override
protected InputStream getSourceStream( String reportId, HttpServletRequest request )
throws IOException, XDocReportException
{
if ( ODT_PROJECT_WITH_VELOCITY_LIST.equals( reportId ) )
{
return Data.class.getResourceAsStream( "ODTProjectWithVelocityList.odt" );
}
if ( DOCX_PROJECT_WITH_VELOCITY_LIST.equals( reportId ) )
{
return Data.class.getResourceAsStream( "DocxProjectWithVelocityList.docx" );
}
throw new XDocReportNotFoundException( reportId );
}
开发者ID:DistX,项目名称:Learning,代码行数:15,代码来源:MyReportServlet.java
示例19: given_aWordTemplate_whenConvertingToPdf_thenTheSamePdfIsGenerated
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
@Test
public void given_aWordTemplate_whenConvertingToPdf_thenTheSamePdfIsGenerated() throws IOException, XDocReportException, PDFGenerationException {
Map<String, Object> context = new HashMap<>();
context.put("test", "cegeka-batchers");
byte[] actual = pdfGeneratorService.generatePdfAsByteArray(new ClassPathResource("test_template.docx"), context);
assertThat(PDDocument.load(new ByteArrayInputStream(actual)))
.containsText("cegeka-batchers is working");
}
开发者ID:cegeka,项目名称:batchers,代码行数:11,代码来源:PDFGeneratorServiceTest.java
示例20: generateDocumentFromTemplate
import fr.opensagres.xdocreport.core.XDocReportException; //导入依赖的package包/类
private static void generateDocumentFromTemplate(
TemplateModel templateModel, OutputStream out)
throws XDocReportException, IOException {
InputStream in = null;
try {
in = templateModel.getTemplateFile().getInputStream();
IXDocReport report = null;
if (TemplateType.VELOCITY.equals(templateModel.getTemplateType())) {
report = XDocReportRegistry.getRegistry().loadReport(in,
TemplateEngineKind.Velocity);
} else {
report = XDocReportRegistry.getRegistry().loadReport(in,
TemplateEngineKind.Freemarker);
}
IContext context = report.createContext();
context.put(templateModel.getInTemplateDesignation(), templateModel);
if (templateModel.getPostProcessor() != null) {
ByteArrayOutputStream tempOutputStream = new ByteArrayOutputStream();
report.process(context, tempOutputStream);
InputStream tempInputStream = new ByteArrayInputStream(
tempOutputStream.toByteArray());
ODSProcessor.transformODS(tempInputStream, out,
templateModel.getPostProcessor());
} else {
report.process(context, out);
}
} finally {
IOUtils.closeQuietly(in);
}
}
开发者ID:Altrusoft,项目名称:docserv,代码行数:34,代码来源:Application.java
注:本文中的fr.opensagres.xdocreport.core.XDocReportException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论