Examples of FreeMarkerTemplate


Examples of org.jboss.forge.addon.templates.freemarker.FreemarkerTemplate

      map.put("idClause", idClause);
      map.put("orderClause", orderClause);
      map.put("resourcePath", resourcePath);

      Resource<URL> templateResource = resourceFactory.create(getClass().getResource("Endpoint.jv"));
      TemplateProcessor processor = processorFactory.fromTemplate(new FreemarkerTemplate(templateResource));
      String output = processor.process(map);
      JavaClass resource = JavaParser.parse(JavaClass.class, output);
      resource.addImport(entity.getQualifiedName());
      resource.setPackage(context.getTargetPackageName());
      return Arrays.asList(resource);
View Full Code Here

Examples of org.jboss.forge.addon.templates.freemarker.FreemarkerTemplate

      this.entity = entity;
      this.idProperty = idProperty;
      this.topLevel = topLevel;
      this.copyCtorBuilder = new StringBuilder();
      this.assembleJPABuilder = new StringBuilder();
      this.initializeJPAEntityFromId = processorFactory.fromTemplate(new FreemarkerTemplate(resourceFactory
               .create(getClass().getResource("InitializeJPAEntityFromId.jv"))));
      this.assembleCollection = processorFactory.fromTemplate(new FreemarkerTemplate(resourceFactory.create(getClass()
               .getResource("AssembleCollection.jv"))));

      this.initializeNestedDTOCollection = processorFactory.fromTemplate(new FreemarkerTemplate(resourceFactory
               .create(getClass().getResource("InitializeNestedDTOCollection.jv"))));

      initName();
      initClassStructure();
      initializeJPAEntityInAssembler();
View Full Code Here

Examples of org.jboss.soa.esb.util.FreeMarkerTemplate

            throw new ConfigurationException("Error adding web.xml to web deployment.", e);
        }
    }

    String getWebXML() throws TemplateException {
        FreeMarkerTemplate template = new FreeMarkerTemplate("templates/web.xml.ftl", WebDeploymentArchive.class);
        Map contextObj = new HashMap();

        contextObj.put("webModel", webModel);
       
        return template.apply(contextObj);
    }
View Full Code Here

Examples of org.jboss.soa.esb.util.FreeMarkerTemplate

            throw new ConfigurationException("Error adding web.xml to web deployment.", e);
        }
    }

    String getJBossWebXML() throws TemplateException {
        FreeMarkerTemplate template = new FreeMarkerTemplate("templates/jboss-web.xml.ftl", WebDeploymentArchive.class);
        Map contextObj = new HashMap();

        contextObj.put("webModel", webModel);

        return template.apply(contextObj);
    }
View Full Code Here

Examples of org.milyn.util.FreeMarkerTemplate

*/
@DecodeType(FreeMarkerTemplate.class)
public class FreeMarkerTemplateDecoder implements DataDecoder {

    public Object decode(String data) throws DataDecodeException {
        return new FreeMarkerTemplate(data);
    }
View Full Code Here

Examples of org.milyn.util.FreeMarkerTemplate

    protected HtmlReportGenerator(ReportConfiguration reportConfiguration) {
        super(reportConfiguration);
    }

    public void applyTemplate(Report report) throws IOException {
        FreeMarkerTemplate template;

        System.out.println();
        System.out.println("****************************************************************************************");
        System.out.println("  HTML REPORT GENERATOR IN USE!!!");
        System.out.println("  Please disable in Production mode.  This feature is a major performance drain!!");
        System.out.println("****************************************************************************************");
        System.out.println();

        if(report instanceof DOMReport) {
            template = new FreeMarkerTemplate("html/template-dom.html", HtmlReportGenerator.class);
        } else {
            template = new FreeMarkerTemplate("html/template-sax.html", HtmlReportGenerator.class);
        }

        Writer writer = getReportConfiguration().getOutputWriter();
        Map templateModel = new HashMap();

        templateModel.put("report", report);
        templateModel.put("htmlEscape", new HtmlEscape());
        writer.write(template.apply(templateModel));
    }
View Full Code Here

Examples of org.milyn.util.FreeMarkerTemplate

        templateParams.put("resource", configMapping.getResourceConfig());
        templateParams.put("execContext", executionContext);
        templateParams.put("event", this);

        if (!summary.equals(AnnotationConstants.NULL_STRING)) {
            FreeMarkerTemplate template = new FreeMarkerTemplate(summary);
            try {
                reportSummary = template.apply(templateParams);
            } catch (Exception e) {
                reportSummary = "Report Template Summary Error: " + e.getMessage();
                logger.debug("Failed to apply Summary Template.", e);
            }
        }

        if (!detailTemplate.equals(AnnotationConstants.NULL_STRING)) {
            FreeMarkerTemplate template = new FreeMarkerTemplate(detailTemplate, handlerClass);
            try {
                reportDetail = template.apply(templateParams);
            } catch (Exception e) {
                reportSummary = "Report Template Detail Error: " + e.getMessage();
                logger.debug("Failed to apply Detail Template.", e);
            }
        }
View Full Code Here

Examples of org.milyn.util.FreeMarkerTemplate

                    namespace = XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
                }
                qName = new QName(namespace, name);
            }

            attributes.put(qName, new FreeMarkerTemplate(value));
        }
    }
View Full Code Here

Examples of org.milyn.util.FreeMarkerTemplate

        this.elementNamespace = namespace;
        return this;
    }

    public SetElementData setAttribute(QName name, String valueTemplate) {
        attributes.put(name, new FreeMarkerTemplate(valueTemplate));
        return this;
    }
View Full Code Here

Examples of org.milyn.util.FreeMarkerTemplate

            Map<String, Object> beans = Filter.getCurrentExecutionContext().getBeanContext().getBeanMap();
            Set<Map.Entry<QName, FreeMarkerTemplate>> attributeSet = attributes.entrySet();

            for(Map.Entry<QName, FreeMarkerTemplate> attributeConfig : attributeSet) {
                QName attribName = attributeConfig.getKey();
                FreeMarkerTemplate valueTemplate = attributeConfig.getValue();
                String namespaceURI = attribName.getNamespaceURI();

                if(namespaceURI != null) {
                    String prefix = attribName.getPrefix();
                    if(prefix != null && prefix.length() > 0) {
                        newElement.setAttributeNS(namespaceURI, prefix + ":" + attribName.getLocalPart(), valueTemplate.apply(beans));
                    } else {
                        newElement.setAttributeNS(namespaceURI, attribName.getLocalPart(), valueTemplate.apply(beans));
                    }
                } else {
                    newElement.setAttribute(attribName.getLocalPart(), valueTemplate.apply(beans));
                }
            }
        }

        return newElement;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.