• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中fr.opensagres.xdocreport.template.IContext的典型用法代码示例。如果您正苦于以下问题:Java IContext类的具体用法?Java IContext怎么用?Java IContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IContext类属于fr.opensagres.xdocreport.template包,在下文中一共展示了IContext类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: preprocessTemplate

import fr.opensagres.xdocreport.template.IContext; //导入依赖的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: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入依赖的package包/类
public void populateContext( IContext context, IXDocReport report, HttpServletRequest request )
{
    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 );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:23,代码来源:ODTProjectWithVelocityListController.java


示例3: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入依赖的package包/类
@Override
protected void populateContext( IContext context, IXDocReport report, HttpServletRequest request )
{
    Boolean defaultReport = report.getData( DEFAULT_REPORT_KEY );
    if ( defaultReport != null && defaultReport.booleanValue() == false )
    {
        MetaDataModel dataModelForm = report.getData( DATA_MODEL_REPORT_KEY );
        if ( dataModelForm != null )
        {
            dataModelForm.populateContext( context, request );
        }
    }
    else
    {
        super.populateContext( context, report, request );
    }
}
 
开发者ID:DistX,项目名称:Learning,代码行数:18,代码来源:ProcessXDocReportServlet.java


示例4: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入依赖的package包/类
public void populateContext( IContext context, IXDocReport report, HttpServletRequest request )
{
    MetaDataModel dataModelForm = report.getData( DATA_MODEL_REPORT_KEY );
    if ( dataModelForm == null )
    {
        // If report was not already loaded (default report) , create
        // default data model
        dataModelForm = getMetaDataModel();
        if ( dataModelForm != null )
        {
            // It's a default report, store the data model in the report
            report.setData( DATA_MODEL_REPORT_KEY, dataModelForm );
        }
    }
    if ( dataModelForm != null )
    {
        dataModelForm.populateContext( context, request );
    }

}
 
开发者ID:DistX,项目名称:Learning,代码行数:21,代码来源:DefaultReportController.java


示例5: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入依赖的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


示例6: generatePdfAsByteArray

import fr.opensagres.xdocreport.template.IContext; //导入依赖的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


示例7: export

import fr.opensagres.xdocreport.template.IContext; //导入依赖的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


示例8: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入依赖的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: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入依赖的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


示例10: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入依赖的package包/类
@Override
public void populateContext( IContext context, HttpServletRequest request )
{

    List<DynamicBean> dataModelList = new ArrayList<DynamicBean>();
    for ( MetaDataModelSimpleField field : fields )
    {
        String name = field.getName();
        String[] values = request.getParameterValues( name );
        if ( values != null )
        {
            for ( int i = 0; i < values.length; i++ )
            {
                DynamicBean bean = null;
                if ( dataModelList.size() >= i + 1 )
                {
                    bean = dataModelList.get( i );
                }
                else
                {
                    bean = new DynamicBean();
                    dataModelList.add( bean );
                }
                String value = values[i];
                String key = name.substring( super.getName().length() + 1, name.length() );
                bean.setValue( key.split( "[.]" ), value, 0 );
            }
        }
    }
    context.put( super.getName(), dataModelList );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:32,代码来源:MetaDataModelListField.java


示例11: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入依赖的package包/类
public void populateContext( IContext context, HttpServletRequest request )
{
    for ( MetaDataModelField field : super.getFields() )
    {
        field.populateContext( context, request );
    }
}
 
开发者ID:DistX,项目名称:Learning,代码行数:8,代码来源:MetaDataModel.java


示例12: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入依赖的package包/类
public void populateContext( IContext context, HttpServletRequest request )
{
    String value = request.getParameter( super.getName() );
    if ( value != null )
    {
        context.put( super.getName(), value );
    }
}
 
开发者ID:DistX,项目名称:Learning,代码行数:9,代码来源:MetaDataModelSimpleField.java


示例13: generateDocumentFromTemplate

import fr.opensagres.xdocreport.template.IContext; //导入依赖的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


示例14: generateLettre

import fr.opensagres.xdocreport.template.IContext; //导入依赖的package包/类
/**
 * @param templateLettre
 * @param data
 * @param fichierSignature
 * @return l'inputstram de la lettre
 */
public InputStream generateLettre(final String templateLettre, final ExportLettreCandidat data,
		final InputStream fichierSignature) {
	InputStream template = MethodUtils.getXDocReportTemplate(templateLettre, i18nController.getLangueCandidat(),
			cacheController.getLangueDefault().getCodLangue());
	if (template == null) {
		return null;
	}
	ByteArrayInOutStream out = new ByteArrayInOutStream();
	try {
		/* Ajout date et heure */
		data.setDateHeure(formatterDateTime.format(LocalDateTime.now()));
		data.setDate(formatterDate.format(LocalDateTime.now()));

		/* Generation du template */
		IXDocReport report = XDocReportRegistry.getRegistry().loadReport(template, TemplateEngineKind.Velocity);

		/* Variables */
		IContext context = report.createContext();
		context.put("data", data);

		/* Pour l'image */
		FieldsMetadata metadata = new FieldsMetadata();
		if (fichierSignature != null) {
			metadata.addFieldAsImage("imageSignature");
			IImageProvider originalSizeLogo = new ByteArrayImageProvider(fichierSignature, true);
			context.put("imageSignature", originalSizeLogo);
		} else {
			/* Si pas de fichier, on supprime l'image */
			metadata.addFieldAsImage("imageSignature", NullImageBehaviour.RemoveImageTemplate);
		}
		report.setFieldsMetadata(metadata);

		/* On vérifie si on affiche le tableau de signataire */
		if (data.getLibelleSignature().equals("") && fichierSignature == null) {
			context.put("showSignataire", false);
		} else {
			context.put("showSignataire", true);
		}

		/* Transformation en pdf */

		Options options = Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.XWPF);

		report.convert(context, options, out);

		return signaturePdfManager.signPdf(out);
	} catch (Exception e) {
		// probleme de taille de signature XDocConverterException + StackOverflowError
		if (e.getClass() != null && e instanceof XDocConverterException && e.getCause() != null
				&& e.getCause() instanceof StackOverflowError) {
			Notification.show(applicationContext.getMessage("candidature.lettre.download.sign.error", null,
					UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
		} else {
			Notification.show(applicationContext.getMessage("candidature.lettre.download.error", null,
					UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
			logger.error("erreur a la création de la lettre", e);
		}

		return null;
	} finally {
		// fermeture des fichiers
		MethodUtils.closeRessource(fichierSignature);
		MethodUtils.closeRessource(template);
		MethodUtils.closeRessource(out);
	}
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:73,代码来源:CandidatureController.java


示例15: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入依赖的package包/类
public void populateContext( IContext context, IXDocReport report, HttpServletRequest request )
{
    String name = request.getParameter( "name" );
    context.put( "name", name );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:6,代码来源:HelloWorldController.java


示例16: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入依赖的package包/类
public abstract void populateContext( IContext context, HttpServletRequest request ); 
开发者ID:DistX,项目名称:Learning,代码行数:2,代码来源:MetaDataModelField.java



注:本文中的fr.opensagres.xdocreport.template.IContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SQLiteUtils类代码示例发布时间:2022-05-22
下一篇:
Java ProtonSender类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap