当前位置: 首页>>代码示例>>Java>>正文


Java TemplateEngineKind类代码示例

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


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

示例1: preprocessTemplate

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

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

示例3: export

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

示例4: getTemplateEngineKind

import fr.opensagres.xdocreport.template.TemplateEngineKind; //导入依赖的package包/类
@Override
protected String getTemplateEngineKind( String reportId, HttpServletRequest request )
{
    if ( ODT_PROJECT_WITH_VELOCITY_LIST.equals( reportId ) || DOCX_PROJECT_WITH_VELOCITY_LIST.equals( reportId ) )
    {
        return TemplateEngineKind.Velocity.name();
    }
    return super.getTemplateEngineKind( reportId, request );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:10,代码来源:MyReportServlet.java

示例5: DefaultReportController

import fr.opensagres.xdocreport.template.TemplateEngineKind; //导入依赖的package包/类
public DefaultReportController( String reportId, TemplateEngineKind templateEngineKind,
                                DocumentKind converterTypeFrom )
{
    super( templateEngineKind, converterTypeFrom );
    this.reportId = reportId;
    this.source = null;
}
 
开发者ID:DistX,项目名称:Learning,代码行数:8,代码来源:DefaultReportController.java

示例6: getTemplateEngineKind

import fr.opensagres.xdocreport.template.TemplateEngineKind; //导入依赖的package包/类
@Override
protected String getTemplateEngineKind( String reportId, HttpServletRequest request )
{
    if ( ODT_HELLO_WORD_WITH_VELOCITY.equals( reportId ) )
    {
        return TemplateEngineKind.Velocity.name();
    }
    return super.getTemplateEngineKind( reportId, request );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:10,代码来源:HelloWorldReportServlet.java

示例7: main

import fr.opensagres.xdocreport.template.TemplateEngineKind; //导入依赖的package包/类
public static void main( String[] args )
{
    try
    {
        FieldsMetadata metadata = new FieldsMetadata( TemplateEngineKind.Velocity );
        metadata.load( "project", ProjectWithImage.class );
        metadata.load( "developers", DeveloperWithImage.class, true );
        metadata.saveXML( System.out );
    }
    catch ( Exception e )
    {
        e.printStackTrace();
    }
}
 
开发者ID:DistX,项目名称:Learning,代码行数:15,代码来源:GenerateXMLFields.java

示例8: main

import fr.opensagres.xdocreport.template.TemplateEngineKind; //导入依赖的package包/类
public static void main( String[] args )
{
    try
    {
        FieldsMetadata metadata = new FieldsMetadata( TemplateEngineKind.Freemarker );
        metadata.load( "project", ProjectWithImage.class );
        metadata.load( "developers", DeveloperWithImage.class, true );
        metadata.saveXML( System.out );
    }
    catch ( Exception e )
    {
        e.printStackTrace();
    }
}
 
开发者ID:DistX,项目名称:Learning,代码行数:15,代码来源:GenerateXMLFields.java

示例9: generateDocumentFromTemplate

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

示例10: generateLettre

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

示例11: ODTProjectWithVelocityListController

import fr.opensagres.xdocreport.template.TemplateEngineKind; //导入依赖的package包/类
public ODTProjectWithVelocityListController()
{
    super( TemplateEngineKind.Velocity, DocumentKind.ODT );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:5,代码来源:ODTProjectWithVelocityListController.java

示例12: DocxProjectWithVelocityListController

import fr.opensagres.xdocreport.template.TemplateEngineKind; //导入依赖的package包/类
public DocxProjectWithVelocityListController()
{
    super( TemplateEngineKind.Velocity, DocumentKind.ODT );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:5,代码来源:DocxProjectWithVelocityListController.java

示例13: DocxBig

import fr.opensagres.xdocreport.template.TemplateEngineKind; //导入依赖的package包/类
public DocxBig()
{
    super( "DocxBig.docx", TemplateEngineKind.Velocity, DocumentKind.DOCX );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:5,代码来源:DocxBig.java

示例14: ODTHelloWorldWithVelocity

import fr.opensagres.xdocreport.template.TemplateEngineKind; //导入依赖的package包/类
public ODTHelloWorldWithVelocity()
{
    super( "ODTHelloWorldWithVelocity.odt", TemplateEngineKind.Velocity, DocumentKind.ODT );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:5,代码来源:ODTHelloWorldWithVelocity.java

示例15: ODTLettreRelance

import fr.opensagres.xdocreport.template.TemplateEngineKind; //导入依赖的package包/类
public ODTLettreRelance()
{
    super( "ODTLettreRelance.odt", TemplateEngineKind.Velocity, DocumentKind.ODT );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:5,代码来源:ODTLettreRelance.java


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