Adding Site Template Programmatically
We know that we can create the site template from the control panel, What if we want to create programmatically. So here we go, 1. We are reterving the site template name form the portlet.properties. If you want to know how to create the portlet.properties and reterive follow the below link. http://liferaytutorial.blogspot.in/2013/03/how-to-read-values-from-properties-file.html So here i am reterving the site name as site.template from portlet.properties file. String siteTemplateNames = PortletProps.get("site.template"); In portlet.properties site.template = SiteTemplate1 , SiteTemplate2 Before adding the site template we are checking weather site template exists for not by dynamicQuery , because we don't have any finder method to check the site template by name. Here i am checking by descrition beacause name will be storing as JSON format in DB. DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(LayoutSetPrototype.class); dynamicQuery....