1
22
23 package com.liferay.portal.kernel.velocity;
24
25 import com.liferay.portal.SystemException;
26
27 import java.io.IOException;
28 import java.io.Writer;
29
30
36 public class VelocityEngineUtil {
37
38 public static void flushTemplate(String resource) {
39 getVelocityEngine().flushTemplate(resource);
40 }
41
42 public static VelocityEngine getVelocityEngine() {
43 return _velocityEngine;
44 }
45
46 public static void init() {
47 getVelocityEngine().init();
48 }
49
50 public static VelocityContext getEmptyContext() {
51 return getVelocityEngine().getEmptyContext();
52 }
53
54 public static VelocityContext getRestrictedToolsContext() {
55 return getVelocityEngine().getRestrictedToolsContext();
56 }
57
58 public static VelocityContext getStandardToolsContext() {
59 return getVelocityEngine().getStandardToolsContext();
60 }
61
62 public static VelocityContext getWrappedRestrictedToolsContext() {
63 return getVelocityEngine().getWrappedRestrictedToolsContext();
64 }
65
66 public static VelocityContext getWrappedStandardToolsContext() {
67 return getVelocityEngine().getWrappedStandardToolsContext();
68 }
69
70 public static boolean mergeTemplate(
71 String velocityTemplateId, VelocityContext velocityContext,
72 Writer writer)
73 throws SystemException, IOException {
74
75 return getVelocityEngine().mergeTemplate(
76 velocityTemplateId, velocityContext, writer);
77 }
78
79 public static boolean mergeTemplate(
80 String velocityTemplateId, String velocityTemplateContent,
81 VelocityContext velocityContext, Writer writer)
82 throws SystemException, IOException {
83
84 return getVelocityEngine().mergeTemplate(
85 velocityTemplateId, velocityTemplateContent, velocityContext,
86 writer);
87 }
88
89 public static boolean resourceExists(String resource) {
90 return getVelocityEngine().resourceExists(resource);
91 }
92
93 public void setVelocityEngine(VelocityEngine velocityEngine) {
94 _velocityEngine = velocityEngine;
95 }
96
97 private static VelocityEngine _velocityEngine;
98
99 }