Navegación por categorías

Se ha producido un error al procesar la plantilla.
The following has evaluated to null or missing:
==> category.getParentCategory()  [in template "49203#49237#1326001" at line 59, column 40]

----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: categoria_padre = category.getParentC...  [in template "49203#49237#1326001" at line 59, column 22]
	- Reached through: #assign-container  [in template "49203#49237#1326001" at line 56, column 13]
----
1<#assign ParamUtil = staticUtil["com.liferay.portal.kernel.util.ParamUtil"] 
2         PortletURLFactoryUtil = staticUtil["com.liferay.portal.kernel.portlet.PortletURLFactoryUtil"] 
3         PortletRequest = staticUtil["javax.portlet.PortletRequest"] 
4         assetCategoryService =  serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService") 
5         assetCategoryPropertyService =  serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryPropertyLocalService") 
6         journalArticleService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") 
7         layoutLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService") 
8         categoryId = ParamUtil.getLong(request,"categoryId", 0) 
9         title =  ParamUtil.getString(request,"title", "") 
10         maxLoop = 100 
11         PropsUtil = staticUtil["com.liferay.portal.kernel.util.PropsUtil"] 
12         portalVocabularyId = PropsUtil.get("juventud.vocabulary.id") 
13         SAXReaderUtil = staticUtil["com.liferay.portal.kernel.xml.SAXReaderUtil"] 
14         imageId = ParamUtil.getString(request,"imageId","") 
15         HtmlUtil = staticUtil["com.liferay.portal.kernel.util.HtmlUtil"] 
16/> 
17 
18<#if (categoryId <= 0) > 
19	<#assign categoryId = ParamUtil.getLong(renderRequest,"categoryId", 0)/> 
20</#if> 
21 
22<#if (categoryId <= 0) > 
23     
24    <#if entries?has_content> 
25	    <#foreach vocabulary in entries> 
26	    	<#if vocabulary.getVocabularyId()+"" == portalVocabularyId> 
27	    	    <#foreach aCategory in vocabulary.getCategories()> 
28	    	        <#assign aCategory = aCategory/> 
29	    	        <#break> 
30	    	    </#foreach> 
31	    	    <#list 1..maxLoop as i> 
32	    	        <#list 1..maxLoop as j> 
33	    	            <#if aCategory.getParentCategory()?has_content> 
34	    	                <#assign aCategory = aCategory.getParentCategory()/> 
35	    	            <#else> 
36	        	            <#assign categoryId = aCategory.getCategoryId()/> 
37	                   </#if>   
38	                   <#break> 
39	    	        </#list> 
40	    	        <#if (categoryId > 0) > 
41	    	            <#break> 
42	    	        </#if> 
43	    	    </#list> 
44	    	</#if> 
45	    </#foreach> 
46	 </#if> 
47     
48</#if> 
49 
50<nav aria-label="breadcrumb"> 
51    <ol class="breadcrumb"> 
52       <li class="breadcrumb-title"><span>${languageUtil.get(locale,"juventud.breadcrumb-title")}</span></li> 
53        <li class="breadcrumb-item"><a href="http://www.asturias.es">${languageUtil.get(locale,"juventud.breadcrumb-asturias")}</a></li> 
54        <#if (categoryId > 0) > 
55 
56            <#assign category = assetCategoryService.getAssetCategory(categoryId) 
57                     categoryAncestors = category.getAncestors() 
58                     breadCrumbContent = "" 
59                     categoria_padre = category.getParentCategory() /> 
60                    
61            <#if categoryAncestors?has_content> 
62                <#foreach categoryAncestor in categoryAncestors> 
63                	 
64                	<#assign hideCategory = false/> 
65                	 
66                	 <#-- obtener el contenido de la categoría hija --> 
67			        <#if assetCategoryPropertyService.getCategoryProperty(categoryAncestor.getCategoryId(),"idContenido") ? has_content > 
68			        	<#assign contentIdProperty = assetCategoryPropertyService.getCategoryProperty(categoryAncestor.getCategoryId(),"idContenido")/> 
69			            <#assign contentId = contentIdProperty.getValue()/> 
70			            <#if contentId ? has_content> 
71			            	<#assign journalArticleSub = journalArticleService.getLatestArticle(groupId,contentId)/> 
72			        		 
73			        		<#if journalArticleSub?has_content> 
74				        		<#-- obtener el contenido de la categoría actual --> 
75				                <#assign document = SAXReaderUtil.read(journalArticleSub.getContentByLocale(locale)) 
76                        		 	pageDetailNode =  document.selectSingleNode("/root/dynamic-element[@name='paginaDetalle']/dynamic-content") 
77                        		 	/> 
78                        		 <#if document.selectSingleNode("/root/dynamic-element[@name='visibleMigas']/dynamic-content")?has_content> 
79                        		 	<#assign visibleMigasNode =  document.selectSingleNode("/root/dynamic-element[@name='visibleMigas']/dynamic-content")  
80                        		 		visibleMigas =  visibleMigasNode.getText() 
81                        		 			 hideCategory = visibleMigas != "1"/> 
82                        		 </#if> 
83				        	</#if> 
84			 	        </#if>			    	  
85			    	  
86				    	 <#if pageDetailNode?has_content && pageDetailNode.getText()?has_content>				           	 
87		        			<#assign  pageDetail = pageDetailNode.getText()/> 
88			        		<#if (pageDetail?index_of("@")>0)> 
89		                		<#assign pageDetailPosition = (pageDetail?index_of("@")-1) 
90		                         	pageDetail = pageDetail[0..pageDetailPosition] 
91		                          	layoutDetail = layoutLocalService.getLayout(themeDisplay.getScopeGroupId(),false,pageDetail?number) 
92		                      	/> 
93		                	</#if>		                	 
94			            <#else>			             
95			           		<#assign detailPage = "general" 
96		            	 		 layoutDetail = layoutLocalService.getFriendlyURLLayout(themeDisplay.getScopeGroupId(), false, "/"+detailPage) />    
97			            </#if> 
98			             
99			            <#assign categoryUrl = PortletURLFactoryUtil.create(request, "com_liferay_asset_categories_navigation_web_portlet_AssetCategoriesNavigationPortlet", layoutDetail.getPlid(), PortletRequest.RENDER_PHASE)    /> 
100	                    ${categoryUrl.setParameter("categoryId",categoryAncestor.getCategoryId()+"")} 
101	                 
102	                	<#if !(hideCategory?has_content && hideCategory)> 
103	                		<#if categoryAncestor.isRootCategory()> 
104		                		<#assign breadCrumbContent = "<li class='breadcrumb-item'><a href='/inicio'>"+categoryAncestor.getTitle(locale)+" </a> </li>"+breadCrumbContent/> 
105		                	<#else> 
106		                    	<#assign breadCrumbContent = "<li class='breadcrumb-item'><a href='"+categoryUrl+"'>"+categoryAncestor.getTitle(locale)+" </a> </li>"+breadCrumbContent/> 
107		                    </#if>	                   		 
108	                   	</#if> 
109	                   
110                	</#if> 
111                </#foreach> 
112                 
113                ${breadCrumbContent} 
114                 
115            </#if> 
116             
117            <#assign hideCategory = false/> 
118            <#if assetCategoryPropertyService.getCategoryProperty(category.getCategoryId(),"idContenido") ? has_content > 
119			        	<#assign contentIdProperty = assetCategoryPropertyService.getCategoryProperty(category.getCategoryId(),"idContenido")/> 
120			            <#assign contentId = contentIdProperty.getValue()/> 
121			            <#if contentId ? has_content> 
122			            	<#assign journalArticleSub = journalArticleService.getLatestArticle(groupId,contentId)/> 
123			        		 
124			        		<#if journalArticleSub?has_content> 
125				        		<#-- obtener el contenido de la categoría actual --> 
126				                <#assign document = SAXReaderUtil.read(journalArticleSub.getContentByLocale(locale)) 
127                        		 	pageDetailNode =  document.selectSingleNode("/root/dynamic-element[@name='paginaDetalle']/dynamic-content") 
128                        		 	/> 
129                        		 <#if document.selectSingleNode("/root/dynamic-element[@name='visibleMigas']/dynamic-content")?has_content> 
130                        		 	<#assign visibleMigasNode =  document.selectSingleNode("/root/dynamic-element[@name='visibleMigas']/dynamic-content")  
131                        		 		visibleMigas =  visibleMigasNode.getText() 
132                        		 			 hideCategory = visibleMigas != "1"/> 
133                        		 </#if> 
134				        	</#if> 
135			 	        </#if>			    	  
136			    	  
137				    	 <#if pageDetailNode?has_content && pageDetailNode.getText()?has_content> 
138			        		<#assign  pageDetail = pageDetailNode.getText()/> 
139			        		<#if (pageDetail?index_of("@")>0)> 
140		                		<#assign pageDetailPosition = (pageDetail?index_of("@")-1) 
141		                         	pageDetail = pageDetail[0..pageDetailPosition] 
142		                          	layoutDetail = layoutLocalService.getLayout(themeDisplay.getScopeGroupId(),false,pageDetail?number) 
143		                      	/> 
144		                	</#if> 
145			            <#else> 
146			            	<#if category.isRootCategory()> 
147			            		<#assign detailPage = "inicio"/> 
148			            	<#else> 
149			            		<#if (categoria_padre?has_content) && (categoria_padre.getTitle(locale)=="${languageUtil.get(locale,'juventud.category.informa-joven')}")> 
150					            	<#assign detailPage = "categorias-informa-joven" /> 
151					           	<#else> 
152			            			<#assign detailPage = "general"/> 
153			            		</#if> 
154			            	</#if> 
155			            	 
156			            	<#assign layoutDetail = layoutLocalService.getFriendlyURLLayout(themeDisplay.getScopeGroupId(), false, "/"+detailPage) /> 
157			            </#if> 
158			             
159			            <#assign categoryUrl = PortletURLFactoryUtil.create(request, "com_liferay_asset_categories_navigation_web_portlet_AssetCategoriesNavigationPortlet", layoutDetail.getPlid(), PortletRequest.RENDER_PHASE)    /> 
160	                    ${categoryUrl.setParameter("categoryId",category.getCategoryId()+"")} 
161	                 
162	                	<#if !(hideCategory?has_content && hideCategory)> 
163	                		<#if category.isRootCategory()> 
164		                		<#if title?has_content> 
165		                			<li class="breadcrumb-item"><a href="/inicio">${category.getTitle(locale)}</a></li>		                		 
166		                		<#else> 
167		                			<li class="breadcrumb-item active">${category.getTitle(locale)}</li> 
168		                		</#if>  
169		                	<#else> 
170		                    	<#if title?has_content> 
171		                			<li class="breadcrumb-item"><a href="${categoryUrl}<#if imageId ? has_content>?imageId=${imageId}&title=${HtmlUtil.escapeURL(category.getTitle(locale))}</#if>">${category.getTitle(locale)}</a></li>		                		 
172		                		<#else> 
173		                			<li class="breadcrumb-item active">${category.getTitle(locale)}</li> 
174		                		</#if>  
175		                    </#if>	                		               		 
176	                   	</#if> 
177                	</#if> 
178        </#if> 
179        <#if title ? has_content> 
180        	<li class="breadcrumb-item active">${title}</li>  
181        </#if> 
182    </ol> 
183</nav> 
184 
185<script type="text/javascript"> 
186	$( document ).ready(function() { 
187		 if(typeof ga !== "undefined") { 
188		 	 var privacyCookie = getPortalPrivacyCookie('juventud_privacyPolicy'); 
189       
190            if (privacyCookie  && privacyCookie == 1) { 
191				 <#if title ? has_content> 
192				 	var pageName = '${title}'; 
193				 <#elseif category ? has_content> 
194				 	var pageName = '${category.getName()}'; 
195				 <#else> 
196				 	var pageName = location.pathname; 
197				 </#if> 
198				 ga( 'send', 'pageview', { 
199				     'page': pageName, 
200				     'title': pageName 
201				} ); 
202
203
204	}); 
205</script> 

Navegación por categorías

Se ha producido un error al procesar la plantilla.
Java method "com.sun.proxy.$Proxy459.getLatestArticle(long, String)" threw an exception when invoked on com.sun.proxy.$Proxy459 object "com.liferay.journal.service.impl.JournalArticleLocalServiceImpl@3db7e877"; see cause exception in the Java stack trace.

----
FTL stack trace ("~" means nesting-related):
	- Failed at: journalArticle = journalArticleServic...  [in template "49203#49237#1326010" at line 15, column 10]
	- Reached through: #assign-container  [in template "49203#49237#1326010" at line 1, column 1]
----
1<#assign ParamUtil = staticUtil["com.liferay.portal.kernel.util.ParamUtil"] 
2         PortletURLFactoryUtil = staticUtil["com.liferay.portal.kernel.portlet.PortletURLFactoryUtil"] 
3         PortletRequest = staticUtil["javax.portlet.PortletRequest"] 
4         assetCategoryService =  serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService") 
5         assetCategoryPropertyService =  serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryPropertyLocalService") 
6         journalArticleService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") 
7         layoutLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService") 
8         categoryId = ParamUtil.getLong(request,"categoryId", 0) 
9         articleId = ParamUtil.getString(request,"articleId", "") 
10         backUrl = ParamUtil.getString(request,"redirect", "") 
11         title =  ParamUtil.getString(request,"title", "") 
12         maxLoop = 100 
13         PropsUtil = staticUtil["com.liferay.portal.kernel.util.PropsUtil"] 
14         SAXReaderUtil = staticUtil["com.liferay.portal.kernel.xml.SAXReaderUtil"] 
15         journalArticle = journalArticleService.getLatestArticle(groupId,articleId) 
16         articleContent = journalArticleService.getArticleContent(journalArticle, "","VIEW", locale, themeDisplay) 
17/> 
18 
19<#if (categoryId <= 0) > 
20	<#assign categoryId = ParamUtil.getLong(renderRequest,"categoryId", 0)/> 
21</#if> 
22 
23<#if (categoryId > 0)> 
24	<#assign category = assetCategoryService.getAssetCategory(categoryId) /> 
25	<div class="card flex-md-row mb-4 box-shadow h-md-250"> 
26	 	<div class="card-body d-flex flex-column align-items-start"> 
27      		 
28        	     
29        		${articleContent} 
30        	                   	 
31       	</div>                                           
32	</div><!-- card -->  
33</#if> 

news-search-juventud Portlet

Navegador por categorías personalizado