public ReportBuilder template(ReportTemplate reportTemplate) { Preconditions.checkNotNull(reportTemplate, "\"reportTemplate\" parameter can not be null"); report.reportTemplates.put(reportTemplate.getCode(), reportTemplate); return this; }
public ReportBuilder template(ReportTemplate reportTemplate) { Preconditions.checkNotNull(reportTemplate, "\"reportTemplate\" parameter can not be null"); report.reportTemplates.put(reportTemplate.getCode(), reportTemplate); return this; }
protected void writeTemplates(Report report, Element root) { Map<String, ReportTemplate> reportTemplates = report.getReportTemplates(); Element reportTemplatesElement = root.addElement("templates"); for (ReportTemplate reportTemplate : reportTemplates.values()) { Element reportTemplateElement = reportTemplatesElement.addElement("template"); reportTemplateElement.addAttribute("code", reportTemplate.getCode()); reportTemplateElement.addAttribute("documentName", reportTemplate.getDocumentName()); reportTemplateElement.addAttribute("documentPath", reportTemplate.getDocumentPath()); reportTemplateElement.addAttribute("outputType", reportTemplate.getOutputType().getId()); reportTemplateElement.addAttribute("outputNamePattern", reportTemplate.getOutputNamePattern()); } }
protected void writeTemplates(Report report, Element root) { Map<String, ReportTemplate> reportTemplates = report.getReportTemplates(); Element reportTemplatesElement = root.addElement("templates"); for (ReportTemplate reportTemplate : reportTemplates.values()) { Element reportTemplateElement = reportTemplatesElement.addElement("template"); reportTemplateElement.addAttribute("code", reportTemplate.getCode()); reportTemplateElement.addAttribute("documentName", reportTemplate.getDocumentName()); reportTemplateElement.addAttribute("documentPath", reportTemplate.getDocumentPath()); reportTemplateElement.addAttribute("outputType", reportTemplate.getOutputType().getId()); reportTemplateElement.addAttribute("outputNamePattern", reportTemplate.getOutputNamePattern()); } }
protected Map<String, ReportTemplate> parseTemplates(Element rootElement) throws IOException { Element templatesElement = rootElement.element("templates"); List<Element> templates = templatesElement.elements("template"); Map<String, ReportTemplate> templateMap = new HashMap<String, ReportTemplate>(); for (Element template : templates) { String code = template.attribute("code").getText(); String documentName = template.attribute("documentName").getText(); String documentPath = template.attribute("documentPath").getText(); String outputType = template.attribute("outputType").getText(); String outputNamePattern = template.attribute("outputNamePattern").getText(); ReportTemplate reportTemplate = new ReportTemplateBuilder() .code(code) .documentName(documentName) .documentPath(documentPath) .documentContent(getDocumentContent(documentPath)) .outputType(ReportOutputType.getOutputTypeById(outputType)) .outputNamePattern(outputNamePattern).build(); templateMap.put(reportTemplate.getCode(), reportTemplate); } return templateMap; }
protected Map<String, ReportTemplate> parseTemplates(Element rootElement) throws IOException { Element templatesElement = rootElement.element("templates"); List<Element> templates = templatesElement.elements("template"); Map<String, ReportTemplate> templateMap = new HashMap<String, ReportTemplate>(); for (Element template : templates) { String code = template.attribute("code").getText(); String documentName = template.attribute("documentName").getText(); String documentPath = template.attribute("documentPath").getText(); String outputType = template.attribute("outputType").getText(); String outputNamePattern = template.attribute("outputNamePattern").getText(); ReportTemplate reportTemplate = new ReportTemplateBuilder() .code(code) .documentName(documentName) .documentPath(documentPath) .documentContent(getDocumentContent(documentPath)) .outputType(ReportOutputType.getOutputTypeById(outputType)) .outputNamePattern(outputNamePattern).build(); templateMap.put(reportTemplate.getCode(), reportTemplate); } return templateMap; }