All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.liferay.portal.kernel.template.TemplateHandler Maven / Gradle / Ivy

There is a newer version: 7.4.3.112-ga112
Show newest version
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.liferay.portal.kernel.template;

import aQute.bnd.annotation.ProviderType;

import com.liferay.portal.kernel.xml.Element;

import java.util.List;
import java.util.Locale;
import java.util.Map;

/**
 * @author Juan Fernández
 */
@ProviderType
public interface TemplateHandler {

	/**
	 * Returns the template handler's class name.
	 *
	 * @return the template handler's class name
	 */
	public String getClassName();

	/**
	 * Returns the map of name/value pairs of the objects that should be
	 * injected into the context.
	 *
	 * @return the objects that should be injected into the context
	 */
	public Map getCustomContextObjects();

	/**
	 * Returns the elements containing the information of the portlet display
	 * templates to be installed by default.
	 *
	 * @return the elements containing the information of the portlet display
	 *         templates to be installed by default. These templates are
	 *         installed when registering the portlet.
	 * @throws Exception if an exception occurred assembling the default
	 *         template elements
	 */
	public List getDefaultTemplateElements() throws Exception;

	/**
	 * Returns the key of the template handler's default template.
	 *
	 * @return the key of the template handler's default template
	 */
	public String getDefaultTemplateKey();

	/**
	 * Returns the template handler's name.
	 *
	 * @param  locale the locale of the template handler name to get
	 * @return the template handler's name
	 */
	public String getName(Locale locale);

	/**
	 * Returns the name of the resource associated with the template.
	 * Permissions on the resource are checked when adding a new template.
	 *
	 * @return the name of the resource associated with the template
	 */
	public String getResourceName();

	/**
	 * Returns the restricted variables that are excluded from the template's
	 * context.
	 *
	 * @param  language the template's scripting language. Acceptable values for
	 *         the FreeMarker, Velocity, or XSL languages are {@link
	 *         TemplateConstants#LANG_TYPE_FTL}, {@link
	 *         TemplateConstants#LANG_TYPE_VM}, or {@link
	 *         TemplateConstants#LANG_TYPE_XSL}, respectively.
	 * @return the restricted variables that are excluded from the template's
	 *         context
	 */
	public String[] getRestrictedVariables(String language);

	/**
	 * Returns initial template content for helping the user create a new
	 * template.
	 *
	 * @param  language the template's scripting language. Acceptable values for
	 *         the FreeMarker, Velocity, or XSL languages are {@link
	 *         TemplateConstants#LANG_TYPE_FTL}, {@link
	 *         TemplateConstants#LANG_TYPE_VM}, or {@link
	 *         TemplateConstants#LANG_TYPE_XSL}, respectively.
	 * @return initial template content for helping the user create a new
	 *         template
	 */
	public String getTemplatesHelpContent(String language);

	/**
	 * Returns the path to the template's help content.
	 *
	 * @param  language the template's scripting language. Acceptable values for
	 *         the FreeMarker, Velocity, or XSL languages are {@link
	 *         TemplateConstants#LANG_TYPE_FTL}, {@link
	 *         TemplateConstants#LANG_TYPE_VM}, or {@link
	 *         TemplateConstants#LANG_TYPE_XSL}, respectively.
	 * @return the path to the template's help content
	 */
	public String getTemplatesHelpPath(String language);

	/**
	 * Returns the name of the property in portal.properties that
	 * defines the path to the template's help content.
	 *
	 * @return the name of the property in portal.properties that
	 *         defines the path to the template's help content
	 */
	public String getTemplatesHelpPropertyKey();

	/**
	 * Returns the template's map of script variable groups for which hints are
	 * displayed in the template editor palette.
	 *
	 * 

* Script variables can be grouped arbitrarily. As examples, a group of * entity fields could be mapped to the keyword Fields, or a * group of general variables portal variables could be mapped to the phrase * General Variables, etc. *

* * @param classPK the primary key of the entity that defines the variable * groups for the template. For example, consider specifying the * primary key of the structure associated to the template. * @param language the template's scripting language. Acceptable values for * the FreeMarker, Velocity, or XSL languages are {@link * TemplateConstants#LANG_TYPE_FTL}, {@link * TemplateConstants#LANG_TYPE_VM}, or {@link * TemplateConstants#LANG_TYPE_XSL}, respectively. * @param locale the locale of the variable groups to get * @return the template's map of script variable groups for which hints are * displayed in the template editor palette * @throws Exception if an exception occurred retrieving the template * variable groups */ public Map getTemplateVariableGroups( long classPK, String language, Locale locale) throws Exception; /** * Returns true if the entity is a display template handler. * * @return true if the entity is a display template handler; * false otherwise */ public boolean isDisplayTemplateHandler(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy