001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.velocity;
016    
017    import com.liferay.portal.kernel.audit.AuditMessageFactoryUtil;
018    import com.liferay.portal.kernel.audit.AuditRouterUtil;
019    import com.liferay.portal.kernel.json.JSONFactoryUtil;
020    import com.liferay.portal.kernel.language.LanguageUtil;
021    import com.liferay.portal.kernel.language.UnicodeLanguageUtil;
022    import com.liferay.portal.kernel.log.Log;
023    import com.liferay.portal.kernel.log.LogFactoryUtil;
024    import com.liferay.portal.kernel.servlet.BrowserSnifferUtil;
025    import com.liferay.portal.kernel.util.ArrayUtil;
026    import com.liferay.portal.kernel.util.ArrayUtil_IW;
027    import com.liferay.portal.kernel.util.DateUtil_IW;
028    import com.liferay.portal.kernel.util.FastDateFormatFactoryUtil;
029    import com.liferay.portal.kernel.util.GetterUtil;
030    import com.liferay.portal.kernel.util.GetterUtil_IW;
031    import com.liferay.portal.kernel.util.HtmlUtil;
032    import com.liferay.portal.kernel.util.HttpUtil;
033    import com.liferay.portal.kernel.util.JavaConstants;
034    import com.liferay.portal.kernel.util.LocaleUtil;
035    import com.liferay.portal.kernel.util.ParamUtil_IW;
036    import com.liferay.portal.kernel.util.PrefsPropsUtil;
037    import com.liferay.portal.kernel.util.PropsUtil;
038    import com.liferay.portal.kernel.util.Randomizer_IW;
039    import com.liferay.portal.kernel.util.StaticFieldGetter;
040    import com.liferay.portal.kernel.util.StringUtil_IW;
041    import com.liferay.portal.kernel.util.TimeZoneUtil_IW;
042    import com.liferay.portal.kernel.util.UnicodeFormatter_IW;
043    import com.liferay.portal.kernel.util.Validator;
044    import com.liferay.portal.kernel.util.Validator_IW;
045    import com.liferay.portal.kernel.velocity.VelocityContext;
046    import com.liferay.portal.kernel.velocity.VelocityVariables;
047    import com.liferay.portal.kernel.xml.SAXReader;
048    import com.liferay.portal.model.Layout;
049    import com.liferay.portal.model.Theme;
050    import com.liferay.portal.service.permission.AccountPermissionUtil;
051    import com.liferay.portal.service.permission.CommonPermissionUtil;
052    import com.liferay.portal.service.permission.GroupPermissionUtil;
053    import com.liferay.portal.service.permission.LayoutPermissionUtil;
054    import com.liferay.portal.service.permission.OrganizationPermissionUtil;
055    import com.liferay.portal.service.permission.PasswordPolicyPermissionUtil;
056    import com.liferay.portal.service.permission.PortalPermissionUtil;
057    import com.liferay.portal.service.permission.PortletPermissionUtil;
058    import com.liferay.portal.service.permission.RolePermissionUtil;
059    import com.liferay.portal.service.permission.UserGroupPermissionUtil;
060    import com.liferay.portal.service.permission.UserPermissionUtil;
061    import com.liferay.portal.theme.NavItem;
062    import com.liferay.portal.theme.RequestVars;
063    import com.liferay.portal.theme.ThemeDisplay;
064    import com.liferay.portal.util.PortalUtil;
065    import com.liferay.portal.util.SessionClicks_IW;
066    import com.liferay.portal.util.WebKeys;
067    import com.liferay.portal.webserver.WebServerServletTokenUtil;
068    import com.liferay.portlet.PortletConfigImpl;
069    import com.liferay.portlet.PortletURLFactoryUtil;
070    import com.liferay.portlet.expando.service.ExpandoColumnLocalService;
071    import com.liferay.portlet.expando.service.ExpandoRowLocalService;
072    import com.liferay.portlet.expando.service.ExpandoTableLocalService;
073    import com.liferay.portlet.expando.service.ExpandoValueLocalService;
074    import com.liferay.portlet.journalcontent.util.JournalContentUtil;
075    import com.liferay.taglib.util.VelocityTaglib;
076    import com.liferay.util.portlet.PortletRequestUtil;
077    
078    import java.lang.reflect.Method;
079    
080    import java.util.List;
081    import java.util.Map;
082    
083    import javax.portlet.PortletRequest;
084    import javax.portlet.PortletResponse;
085    import javax.portlet.RenderRequest;
086    import javax.portlet.RenderResponse;
087    
088    import javax.servlet.http.HttpServletRequest;
089    
090    import org.apache.struts.taglib.tiles.ComponentConstants;
091    import org.apache.struts.tiles.ComponentContext;
092    import org.apache.velocity.tools.generic.DateTool;
093    import org.apache.velocity.tools.generic.EscapeTool;
094    import org.apache.velocity.tools.generic.IteratorTool;
095    import org.apache.velocity.tools.generic.ListTool;
096    import org.apache.velocity.tools.generic.MathTool;
097    import org.apache.velocity.tools.generic.NumberTool;
098    import org.apache.velocity.tools.generic.SortTool;
099    
100    /**
101     * @author Brian Wing Shun Chan
102     * @author Raymond Augé
103     */
104    public class VelocityVariablesImpl implements VelocityVariables {
105    
106            public void insertHelperUtilities(
107                    VelocityContext velocityContext, String[] restrictedVariables) {
108    
109                    // Array util
110    
111                    velocityContext.put("arrayUtil", ArrayUtil_IW.getInstance());
112    
113                    // Audit message factory
114    
115                    try {
116                            velocityContext.put(
117                                    "auditMessageFactoryUtil",
118                                    AuditMessageFactoryUtil.getAuditMessageFactory());
119                    }
120                    catch (SecurityException se) {
121                            _log.error(se, se);
122                    }
123    
124                    // Audit router util
125    
126                    try {
127                            velocityContext.put(
128                                    "auditRouterUtil", AuditRouterUtil.getAuditRouter());
129                    }
130                    catch (SecurityException se) {
131                            _log.error(se, se);
132                    }
133    
134                    // Browser sniffer
135    
136                    try {
137                            velocityContext.put(
138                                    "browserSniffer", BrowserSnifferUtil.getBrowserSniffer());
139                    }
140                    catch (SecurityException se) {
141                            _log.error(se, se);
142                    }
143    
144                    // Date format
145    
146                    try {
147                            velocityContext.put(
148                                    "dateFormatFactory",
149                                    FastDateFormatFactoryUtil.getFastDateFormatFactory());
150                    }
151                    catch (SecurityException se) {
152                            _log.error(se, se);
153                    }
154    
155                    // Date tool
156    
157                    velocityContext.put("dateTool", new DateTool());
158    
159                    // Date util
160    
161                    velocityContext.put("dateUtil", DateUtil_IW.getInstance());
162    
163                    // Escape tool
164    
165                    velocityContext.put("escapeTool", new EscapeTool());
166    
167                    // Service locator
168    
169                    try {
170                            ServiceLocator serviceLocator = ServiceLocator.getInstance();
171    
172                            insertHelperUtility(
173                                    velocityContext, restrictedVariables, "serviceLocator",
174                                    serviceLocator);
175    
176                            // Expando column service
177    
178                            try {
179                                    velocityContext.put(
180                                            "expandoColumnLocalService",
181                                            serviceLocator.findService(
182                                                    ExpandoColumnLocalService.class.getName()));
183                            }
184                            catch (SecurityException se) {
185                                    _log.error(se, se);
186                            }
187    
188                            // Expando row service
189    
190                            try {
191                                    velocityContext.put(
192                                            "expandoRowLocalService",
193                                            serviceLocator.findService(
194                                                    ExpandoRowLocalService.class.getName()));
195                            }
196                            catch (SecurityException se) {
197                                    _log.error(se, se);
198                            }
199    
200                            // Expando table service
201    
202                            try {
203                                    velocityContext.put(
204                                            "expandoTableLocalService",
205                                            serviceLocator.findService(
206                                                    ExpandoTableLocalService.class.getName()));
207                            }
208                            catch (SecurityException se) {
209                                    _log.error(se, se);
210                            }
211    
212                            // Expando value service
213    
214                            try {
215                                    velocityContext.put(
216                                            "expandoValueLocalService",
217                                            serviceLocator.findService(
218                                                    ExpandoValueLocalService.class.getName()));
219                            }
220                            catch (SecurityException se) {
221                                    _log.error(se, se);
222                            }
223                    }
224                    catch (SecurityException se) {
225                            _log.error(se, se);
226                    }
227    
228                    // Getter util
229    
230                    velocityContext.put("getterUtil", GetterUtil_IW.getInstance());
231    
232                    // Html util
233    
234                    try {
235                            velocityContext.put("htmlUtil", HtmlUtil.getHtml());
236                    }
237                    catch (SecurityException se) {
238                            _log.error(se, se);
239                    }
240    
241                    // Http util
242    
243                    try {
244                            velocityContext.put("httpUtil", HttpUtil.getHttp());
245                    }
246                    catch (SecurityException se) {
247                            _log.error(se, se);
248                    }
249    
250                    // Iterator tool
251    
252                    velocityContext.put("iteratorTool", new IteratorTool());
253    
254                    // Journal content util
255    
256                    try {
257                            velocityContext.put(
258                                    "journalContentUtil", JournalContentUtil.getJournalContent());
259                    }
260                    catch (SecurityException se) {
261                            _log.error(se, se);
262                    }
263    
264                    // JSON factory util
265    
266                    try {
267                            velocityContext.put(
268                                    "jsonFactoryUtil", JSONFactoryUtil.getJSONFactory());
269                    }
270                    catch (SecurityException se) {
271                            _log.error(se, se);
272                    }
273    
274                    // Language util
275    
276                    try {
277                            velocityContext.put("languageUtil", LanguageUtil.getLanguage());
278                    }
279                    catch (SecurityException se) {
280                            _log.error(se, se);
281                    }
282    
283                    try {
284                            velocityContext.put(
285                                    "unicodeLanguageUtil",
286                                    UnicodeLanguageUtil.getUnicodeLanguage());
287                    }
288                    catch (SecurityException se) {
289                            _log.error(se, se);
290                    }
291    
292                    // List tool
293    
294                    velocityContext.put("listTool", new ListTool());
295    
296                    // Locale util
297    
298                    try {
299                            velocityContext.put("localeUtil", LocaleUtil.getInstance());
300                    }
301                    catch (SecurityException se) {
302                            _log.error(se, se);
303                    }
304    
305                    // Math tool
306    
307                    velocityContext.put("mathTool", new MathTool());
308    
309                    // Number tool
310    
311                    velocityContext.put("numberTool", new NumberTool());
312    
313                    // Param util
314    
315                    velocityContext.put("paramUtil", ParamUtil_IW.getInstance());
316    
317                    // Portal util
318    
319                    try {
320                            insertHelperUtility(
321                                    velocityContext, restrictedVariables, "portalUtil",
322                                    PortalUtil.getPortal());
323                            insertHelperUtility(
324                                    velocityContext, restrictedVariables, "portal",
325                                    PortalUtil.getPortal());
326                    }
327                    catch (SecurityException se) {
328                            _log.error(se, se);
329                    }
330    
331                    // Prefs props util
332    
333                    try {
334                            insertHelperUtility(
335                                    velocityContext, restrictedVariables, "prefsPropsUtil",
336                                    PrefsPropsUtil.getPrefsProps());
337                    }
338                    catch (SecurityException se) {
339                            _log.error(se, se);
340                    }
341    
342                    // Props util
343    
344                    try {
345                            insertHelperUtility(
346                                    velocityContext, restrictedVariables, "propsUtil",
347                                    PropsUtil.getProps());
348                    }
349                    catch (SecurityException se) {
350                            _log.error(se, se);
351                    }
352    
353                    // Portlet URL factory
354    
355                    try {
356                            velocityContext.put(
357                                    "portletURLFactory",
358                                    PortletURLFactoryUtil.getPortletURLFactory());
359                    }
360                    catch (SecurityException se) {
361                            _log.error(se, se);
362                    }
363    
364                    // Portlet preferences
365    
366                    insertHelperUtility(
367                            velocityContext, restrictedVariables, "velocityPortletPreferences",
368                            new VelocityPortletPreferences());
369    
370                    // Randomizer
371    
372                    velocityContext.put(
373                            "randomizer", Randomizer_IW.getInstance().getWrappedInstance());
374    
375                    // Util locator
376    
377                    try {
378                            UtilLocator utilLocator = UtilLocator.getInstance();
379    
380                            insertHelperUtility(
381                                    velocityContext, restrictedVariables, "utilLocator",
382                                    utilLocator);
383    
384                            // SAX reader util
385    
386                            try {
387                                    velocityContext.put(
388                                            "saxReaderUtil",
389                                            utilLocator.findUtil(SAXReader.class.getName()));
390                            }
391                            catch (SecurityException se) {
392                                    _log.error(se, se);
393                            }
394                    }
395                    catch (SecurityException se) {
396                            _log.error(se, se);
397                    }
398    
399                    // Session clicks
400    
401                    try {
402                            insertHelperUtility(
403                                    velocityContext, restrictedVariables, "sessionClicks",
404                                    SessionClicks_IW.getInstance());
405                    }
406                    catch (SecurityException se) {
407                            _log.error(se, se);
408                    }
409    
410                    // Sort tool
411    
412                    velocityContext.put("sortTool", new SortTool());
413    
414                    // Static field getter
415    
416                    velocityContext.put(
417                            "staticFieldGetter", StaticFieldGetter.getInstance());
418    
419                    // String util
420    
421                    velocityContext.put("stringUtil", StringUtil_IW.getInstance());
422    
423                    // Time zone util
424    
425                    velocityContext.put("timeZoneUtil", TimeZoneUtil_IW.getInstance());
426    
427                    // Unicode formatter
428    
429                    velocityContext.put(
430                            "unicodeFormatter", UnicodeFormatter_IW.getInstance());
431    
432                    // Validator
433    
434                    velocityContext.put("validator", Validator_IW.getInstance());
435    
436                    // VelocityTaglib methods
437    
438                    try {
439                            Class<?> clazz = VelocityTaglib.class;
440    
441                            Method method = clazz.getMethod(
442                                    "layoutIcon", new Class[] {Layout.class});
443    
444                            velocityContext.put("velocityTaglib#layoutIcon", method);
445                    }
446                    catch (Exception e) {
447                            _log.error(e, e);
448                    }
449    
450                    // Web server servlet token
451    
452                    try {
453                            velocityContext.put(
454                                    "webServerToken",
455                                    WebServerServletTokenUtil.getWebServerServletToken());
456                    }
457                    catch (SecurityException se) {
458                            _log.error(se, se);
459                    }
460    
461                    // Permissions
462    
463                    try {
464                            velocityContext.put(
465                                    "accountPermission",
466                                    AccountPermissionUtil.getAccountPermission());
467                    }
468                    catch (SecurityException se) {
469                            _log.error(se, se);
470                    }
471    
472                    try {
473                            velocityContext.put(
474                                    "commonPermission", CommonPermissionUtil.getCommonPermission());
475                    }
476                    catch (SecurityException se) {
477                            _log.error(se, se);
478                    }
479    
480                    try {
481                            velocityContext.put(
482                                    "groupPermission", GroupPermissionUtil.getGroupPermission());
483                    }
484                    catch (SecurityException se) {
485                            _log.error(se, se);
486                    }
487    
488                    try {
489                            velocityContext.put(
490                                    "layoutPermission", LayoutPermissionUtil.getLayoutPermission());
491                    }
492                    catch (SecurityException se) {
493                            _log.error(se, se);
494                    }
495    
496                    try {
497                            velocityContext.put(
498                                    "organizationPermission",
499                                    OrganizationPermissionUtil.getOrganizationPermission());
500                    }
501                    catch (SecurityException se) {
502                            _log.error(se, se);
503                    }
504    
505                    try {
506                            velocityContext.put(
507                                    "passwordPolicyPermission",
508                                    PasswordPolicyPermissionUtil.getPasswordPolicyPermission());
509                    }
510                    catch (SecurityException se) {
511                            _log.error(se, se);
512                    }
513    
514                    try {
515                            velocityContext.put(
516                                    "portalPermission", PortalPermissionUtil.getPortalPermission());
517                    }
518                    catch (SecurityException se) {
519                            _log.error(se, se);
520                    }
521    
522                    try {
523                            velocityContext.put(
524                                    "portletPermission",
525                                    PortletPermissionUtil.getPortletPermission());
526                    }
527                    catch (SecurityException se) {
528                            _log.error(se, se);
529                    }
530    
531                    try {
532                            velocityContext.put(
533                                    "rolePermission", RolePermissionUtil.getRolePermission());
534                    }
535                    catch (SecurityException se) {
536                            _log.error(se, se);
537                    }
538    
539                    try {
540                            velocityContext.put(
541                                    "userGroupPermission",
542                                    UserGroupPermissionUtil.getUserGroupPermission());
543                    }
544                    catch (SecurityException se) {
545                            _log.error(se, se);
546                    }
547    
548                    try {
549                            velocityContext.put(
550                                    "userPermission", UserPermissionUtil.getUserPermission());
551                    }
552                    catch (SecurityException se) {
553                            _log.error(se, se);
554                    }
555    
556                    // Deprecated
557    
558                    try {
559                            velocityContext.put(
560                                    "dateFormats",
561                                    FastDateFormatFactoryUtil.getFastDateFormatFactory());
562                    }
563                    catch (SecurityException se) {
564                            _log.error(se, se);
565                    }
566    
567                    try {
568                            velocityContext.put(
569                                    "imageToken",
570                                    WebServerServletTokenUtil.getWebServerServletToken());
571                    }
572                    catch (SecurityException se) {
573                            _log.error(se, se);
574                    }
575    
576                    try {
577                            velocityContext.put(
578                                    "locationPermission",
579                                    OrganizationPermissionUtil.getOrganizationPermission());
580                    }
581                    catch (SecurityException se) {
582                            _log.error(se, se);
583                    }
584            }
585    
586            public void insertVariables(
587                            VelocityContext velocityContext, HttpServletRequest request)
588                    throws Exception {
589    
590                    // Request
591    
592                    velocityContext.put("request", request);
593    
594                    // Portlet config
595    
596                    PortletConfigImpl portletConfigImpl =
597                            (PortletConfigImpl)request.getAttribute(
598                                    JavaConstants.JAVAX_PORTLET_CONFIG);
599    
600                    if (portletConfigImpl != null) {
601                            velocityContext.put("portletConfig", portletConfigImpl);
602                    }
603    
604                    // Render request
605    
606                    final PortletRequest portletRequest =
607                            (PortletRequest)request.getAttribute(
608                                    JavaConstants.JAVAX_PORTLET_REQUEST);
609    
610                    if (portletRequest != null) {
611                            if (portletRequest instanceof RenderRequest) {
612                                    velocityContext.put("renderRequest", portletRequest);
613                            }
614                    }
615    
616                    // Render response
617    
618                    final PortletResponse portletResponse =
619                            (PortletResponse)request.getAttribute(
620                                    JavaConstants.JAVAX_PORTLET_RESPONSE);
621    
622                    if (portletResponse != null) {
623                            if (portletResponse instanceof RenderResponse) {
624                                    velocityContext.put("renderResponse", portletResponse);
625                            }
626                    }
627    
628                    // XML request
629    
630                    if ((portletRequest != null) && (portletResponse != null)) {
631                            velocityContext.put(
632                                    "xmlRequest",
633                                    new Object() {
634    
635                                            @Override
636                                            public String toString() {
637                                                    return PortletRequestUtil.toXML(
638                                                            portletRequest, portletResponse);
639                                            }
640    
641                                    }
642                            );
643                    }
644    
645                    // Theme display
646    
647                    ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
648                            WebKeys.THEME_DISPLAY);
649    
650                    if (themeDisplay != null) {
651                            Layout layout = themeDisplay.getLayout();
652                            List<Layout> layouts = themeDisplay.getLayouts();
653    
654                            velocityContext.put("themeDisplay", themeDisplay);
655                            velocityContext.put("company", themeDisplay.getCompany());
656                            velocityContext.put("user", themeDisplay.getUser());
657                            velocityContext.put("realUser", themeDisplay.getRealUser());
658                            velocityContext.put("layout", layout);
659                            velocityContext.put("layouts", layouts);
660                            velocityContext.put("plid", String.valueOf(themeDisplay.getPlid()));
661                            velocityContext.put(
662                                    "layoutTypePortlet", themeDisplay.getLayoutTypePortlet());
663                            velocityContext.put(
664                                    "scopeGroupId", new Long(themeDisplay.getScopeGroupId()));
665                            velocityContext.put(
666                                    "permissionChecker", themeDisplay.getPermissionChecker());
667                            velocityContext.put("locale", themeDisplay.getLocale());
668                            velocityContext.put("timeZone", themeDisplay.getTimeZone());
669                            velocityContext.put("colorScheme", themeDisplay.getColorScheme());
670                            velocityContext.put(
671                                    "portletDisplay", themeDisplay.getPortletDisplay());
672    
673                            // Navigation items
674    
675                            if (layout != null) {
676                                    RequestVars requestVars = new RequestVars(
677                                            request, themeDisplay, layout.getAncestorPlid(),
678                                            layout.getAncestorLayoutId(), velocityContext);
679    
680                                    List<NavItem> navItems = NavItem.fromLayouts(
681                                            requestVars, layouts);
682    
683                                    velocityContext.put("navItems", navItems);
684                            }
685    
686                            // Init
687    
688                            velocityContext.put(
689                                    "init",
690                                    themeDisplay.getPathContext() +
691                                            VelocityResourceListener.SERVLET_SEPARATOR +
692                                                    "/html/themes/_unstyled/templates/init.vm");
693    
694                            // Deprecated
695    
696                            velocityContext.put(
697                                    "portletGroupId", new Long(themeDisplay.getScopeGroupId()));
698                    }
699    
700                    // Theme
701    
702                    Theme theme = (Theme)request.getAttribute(WebKeys.THEME);
703    
704                    if ((theme == null) && (themeDisplay != null)) {
705                            theme = themeDisplay.getTheme();
706                    }
707    
708                    if (theme != null) {
709    
710                            // Full css and templates path
711    
712                            velocityContext.put("theme", theme);
713    
714                            String servletContextName = GetterUtil.getString(
715                                    theme.getServletContextName());
716    
717                            velocityContext.put(
718                                    "fullCssPath",
719                                    servletContextName + theme.getVelocityResourceListener() +
720                                            theme.getCssPath());
721    
722                            velocityContext.put(
723                                    "fullTemplatesPath",
724                                    servletContextName + theme.getVelocityResourceListener() +
725                                            theme.getTemplatesPath());
726                    }
727    
728                    // Tiles attributes
729    
730                    insertTilesVariables(velocityContext, request);
731    
732                    // Page title and subtitle
733    
734                    velocityContext.put(
735                            "pageTitle", request.getAttribute(WebKeys.PAGE_TITLE));
736                    velocityContext.put(
737                            "pageSubtitle", request.getAttribute(WebKeys.PAGE_SUBTITLE));
738    
739                    // Insert custom vm variables
740    
741                    Map<String, Object> vmVariables =
742                            (Map<String, Object>)request.getAttribute(WebKeys.VM_VARIABLES);
743    
744                    if (vmVariables != null) {
745                            for (Map.Entry<String, Object> entry : vmVariables.entrySet()) {
746                                    String key = entry.getKey();
747                                    Object value = entry.getValue();
748    
749                                    if (Validator.isNotNull(key)) {
750                                            velocityContext.put(key, value);
751                                    }
752                            }
753                    }
754            }
755    
756            protected void insertHelperUtility(
757                    VelocityContext velocityContext, String[] restrictedVariables,
758                    String key, Object value) {
759    
760                    if (!ArrayUtil.contains(restrictedVariables, key)) {
761                            velocityContext.put(key, value);
762                    }
763            }
764    
765            protected void insertTilesVariables(
766                    VelocityContext velocityContext, HttpServletRequest request) {
767    
768                    ComponentContext componentContext =
769                            (ComponentContext)request.getAttribute(
770                                    ComponentConstants.COMPONENT_CONTEXT);
771    
772                    if (componentContext == null) {
773                            return;
774                    }
775    
776                    ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
777                            WebKeys.THEME_DISPLAY);
778    
779                    String tilesTitle = (String)componentContext.getAttribute("title");
780    
781                    themeDisplay.setTilesTitle(tilesTitle);
782    
783                    velocityContext.put("tilesTitle", tilesTitle);
784    
785                    String tilesContent = (String)componentContext.getAttribute("content");
786    
787                    themeDisplay.setTilesContent(tilesContent);
788    
789                    velocityContext.put("tilesContent", tilesContent);
790    
791                    boolean tilesSelectable = GetterUtil.getBoolean(
792                            (String)componentContext.getAttribute("selectable"));
793    
794                    themeDisplay.setTilesSelectable(tilesSelectable);
795    
796                    velocityContext.put("tilesSelectable", tilesSelectable);
797            }
798    
799            private static Log _log = LogFactoryUtil.getLog(
800                    VelocityVariablesImpl.class);
801    
802    }