Navegación por categorías

Navegación por categorías

Se ha producido un error al procesar la plantilla.
Java method "com.sun.proxy.$Proxy75.getAssetCategory(long)" threw an exception when invoked on com.sun.proxy.$Proxy75 object "com.liferay.portlet.asset.service.impl.AssetCategoryLocalServiceImpl@5aeef38f"; see cause exception in the Java stack trace.

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign currentCategory = assetCatego...  [in template "646115#646149#789937" at line 16, column 10]
----
1<#assign assetCategoriesCustomService = serviceLocator.findService("pa.mtl.assetcategories.customservice.api.AssetCategoriesCustomServiceApi") 
2		 assetCategoryService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService") 
3		 assetCategoryPropertyService =  serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryPropertyLocalService") 
4		 SAXReaderUtil = staticUtil["com.liferay.portal.kernel.xml.SAXReaderUtil"] 
5		 HtmlUtil = staticUtil["com.liferay.portal.kernel.util.HtmlUtil"] 
6		 layoutLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService") 
7		 PortletURLFactoryUtil = staticUtil["com.liferay.portal.kernel.portlet.PortletURLFactoryUtil"] 
8		 PortletRequest = staticUtil["javax.portlet.PortletRequest"]     
9		 journalArticleService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") 
10		 ParamUtil = staticUtil["com.liferay.portal.kernel.util.ParamUtil"]   
11		 categoryId =ParamUtil.getLong(renderRequest,"categoryId", 0) 
12		 categoryName = ParamUtil.getString(request,"categoryName", "") 
13/> 
14 
15<#if ! currentCategory ? has_content > 
16	 <#assign currentCategory = assetCategoryService.getAssetCategory(categoryId)/> 
17</#if> 
18 
19<#assign childCategories = assetCategoriesCustomService.getChildCategoriesOrdered(categoryId,locale) 
20         showContents = true 
21         forceShowCategories = false 
22/> 
23 
24<#assign structureArticulo = assetCategoriesCustomService.findStructure("ARTICULO", groupId)/> 
25<#assign structureEnlace = assetCategoriesCustomService.findStructure("ENLACE", groupId)/> 
26 
27<#assign sin_grandchildCategories =  0 /> 
28<#assign cat_nivel_1 = 0 /> 
29 
30 
31<#assign TPL_categoria_img_acceso = "173202" /> 
32 
33 
34<#-- Pintar subcategorías --> 
35<#if childCategories?has_content>			 
36	 <div class="card flex-md-row mb-4 box-shadow h-md-250"> 
37        <div class="card-body d-flex flex-column align-items-start listado-categorias">   
38			<#assign hay_contenido_cat = 0 /> 
39			 
40			<#list childCategories as childCategory> 
41				<#assign contentId = (assetCategoryPropertyService.getCategoryProperty(childCategory.getCategoryId(), "idContenido").getValue())!""/> 
42				<#assign journalArticleSub = journalArticleService.getLatestArticle(groupId,contentId)/> 
43				<#if journalArticleSub.getStatus() == 0>	 
44					<#if contentId ? has_content>	 
45						<#assign hay_contenido_cat = hay_contenido_cat + 1 /> 
46		 
47						<#--compruebo si tiene nietas, si no las tiene es que ella misma es nieta --> 
48					 
49						<#if journalArticleSub?has_content>   
50			               	<#assign grandchildCategories = assetCategoriesCustomService.getChildCategoriesOrdered(childCategory.getCategoryId(),locale) /> 
51			               	<#if grandchildCategories?has_content>	 
52			               		<#assign cat_nivel_1 = 1 />                    	 
53			               	</#if> 
54			            </#if> 
55					</#if> 
56				 </#if> 
57			</#list>  
58			 
59			 
60			<h2 class="mb-0">${currentCategory.getTitle(locale)}</h2>      
61			<#assign contentId = (assetCategoryPropertyService.getCategoryProperty(currentCategory.getCategoryId(), "idContenido").getValue())!""/> 
62			<#if contentId ? has_content>	  							 
63                <#assign journalArticleCat = journalArticleService.getLatestArticle(groupId,contentId)/> 
64            </#if> 
65							 
66	  		<#list childCategories as childCategory>	 
67	  			<#assign contentId = (assetCategoryPropertyService.getCategoryProperty(childCategory.getCategoryId(), "idContenido").getValue())!""/> 
68				<#if contentId ? has_content>	  							 
69	                    <#assign journalArticleSub = journalArticleService.getLatestArticle(groupId,contentId)/>	 
70	                    <#if journalArticleSub.getStatus() == 0>	                     
71		                    <#assign document = SAXReaderUtil.read(journalArticleSub.getContentByLocale(locale)) 
72								paginaDetalleNode =  document.selectSingleNode("/root/dynamic-element[@name='paginaDetalle']/dynamic-content")							 
73			                    descripcionNode = document.selectSingleNode("/root/dynamic-element[@name='descripcion']/dynamic-content") 
74		                     	descripcion = HtmlUtil.stripHtml(descripcionNode.getText()) 
75							/> 
76		 
77							<#if paginaDetalleNode?has_content && paginaDetalleNode.getText()?has_content> 
78								<#assign  pageDetail = paginaDetalleNode.getText()/> 
79								<#if (pageDetail?index_of("@")>0)> 
80									<#assign pageDetailPosition = (pageDetail?index_of("@")-1) 
81		 								pageDetail = pageDetail[0..pageDetailPosition] 
82		 								layoutDetail = layoutLocalService.getLayout(themeDisplay.getScopeGroupId(),false,pageDetail?number)		 
83									/> 
84								</#if> 
85							<#else> 
86		                        <#assign detailPage = "general" 
87		                                 layoutDetail = layoutLocalService.getFriendlyURLLayout(themeDisplay.getScopeGroupId(), false, "/"+detailPage) /> 
88							</#if> 
89								 
90							<#assign categoryUrl = PortletURLFactoryUtil.create(request, "com_liferay_asset_categories_navigation_web_portlet_AssetCategoriesNavigationPortlet", layoutDetail.getPlid(), PortletRequest.RENDER_PHASE)/> 
91							${categoryUrl.setParameter("categoryId", childCategory.getCategoryId()+"")}															 
92		 
93		                    <#if journalArticleSub?has_content>   
94		                    	<#assign grandchildCategories = assetCategoriesCustomService.getChildCategoriesOrdered(childCategory.getCategoryId(),locale) 
95								         showContents = true 
96								         forceShowCategories = false 
97								/> 
98								<#if cat_nivel_1 == 1 > 
99									<#if grandchildCategories?has_content>	 
100										 
101										<div class="categoria-asociada"> 
102				                            <div class="row"> 
103				                                <div class="col-md-2 categoria-imagen"> 
104				                                	<#assign contenidoImagen = journalArticleService.getArticleContent(journalArticleSub, TPL_categoria_img_acceso, "VIEW", locale, themeDisplay)/> 
105				                                	${contenidoImagen}		                                	  
106				                                </div> 
107				                                <div class="col-md-10"> 
108				                                    <h3 class="title">${childCategory.getTitle(locale)}</h3> 									 
109													 
110														<#assign contador = 0 /> 
111														<#list grandchildCategories as grandchildCategory> 
112			                                            	<#if assetCategoryPropertyService.getCategoryProperty(grandchildCategory.getCategoryId(),"idContenido") ? has_content > 
113										                        <#assign contentIdProperty = assetCategoryPropertyService.getCategoryProperty(grandchildCategory.getCategoryId(),"idContenido")/> 
114										                        <#assign contentId = contentIdProperty.getValue()/> 
115										                        <#if contentId ? has_content> 
116										                            <#assign journalArticleSubSub = journalArticleService.getLatestArticle(groupId,contentId)/> 
117										                            <#if journalArticleSubSub.getStatus() == 0>		 
118											                            <#assign document = SAXReaderUtil.read(journalArticleSubSub.getContentByLocale(locale)) 
119																			paginaDetalleNode =  document.selectSingleNode("/root/dynamic-element[@name='paginaDetalle']/dynamic-content") 
120																			descripcionNode = document.selectSingleNode("/root/dynamic-element[@name='descripcion']/dynamic-content") 
121																			titleNode = document.selectSingleNode("/root/dynamic-element[@name='texto']/dynamic-content") 
122																			texto = HtmlUtil.stripHtml(titleNode.getText())	 
123				                     										descripcion = HtmlUtil.stripHtml(descripcionNode.getText())													                      
124																		/> 
125																		 
126																		<#if paginaDetalleNode?has_content && paginaDetalleNode.getText()?has_content> 
127																			<#assign  pageDetail = paginaDetalleNode.getText()/> 
128																			<#if (pageDetail?index_of("@")>0)> 
129																				<#assign pageDetailPosition = (pageDetail?index_of("@")-1) 
130													 								pageDetail = pageDetail[0..pageDetailPosition] 
131													 								layoutDetail = layoutLocalService.getLayout(themeDisplay.getScopeGroupId(),false,pageDetail?number)					                          					  
132																				/> 
133																			</#if> 
134																		<#else> 
135										                                    <#assign detailPage = "general" 
136										                                             layoutDetail = layoutLocalService.getFriendlyURLLayout(themeDisplay.getScopeGroupId(), false, "/"+detailPage) /> 
137																		</#if> 
138																		 
139																		<#assign grandchildCategoryUrl = PortletURLFactoryUtil.create(request, "com_liferay_asset_categories_navigation_web_portlet_AssetCategoriesNavigationPortlet", layoutDetail.getPlid(), PortletRequest.RENDER_PHASE)/> 
140																		${grandchildCategoryUrl.setParameter("categoryId", grandchildCategory.getCategoryId()+"")}	 
141										 
142																		<div class="col-md-6 articulo-relacionado"> 
143				                                                        	<h4 class="title">${texto}</h4>                                                    
144				                                                            <div class="summary">${descripcion}</div>                          
145				                                                            <div class="link-more"> 
146										                               			<a class="more-information" title="${languageUtil.get(locale,'medio.ambiente.general.more-info-about')} ${grandchildCategory.getTitle(locale)}" 
147										                               				href="${grandchildCategoryUrl}" >${languageUtil.get(locale,'medio.ambiente.general.more-info')}</a> 
148										                               		</div>	 
149				                                                        </div>  
150				                                                        <#assign contador = contador +1 />  
151				                                                     </#if> 
152																</#if> 
153															</#if> 
154															<#if contador == 4> 
155														    	<#break> 
156														  	</#if> 
157														</#list>  
158														<#-- Cuando hay más de 4 mostramos el enlace --> 
159											        	<#if grandchildCategories?size gt 4> 
160															<div class="col-md-12">	 
161																<div class="link-more"> 
162							                               			<a class="more-information" title="${languageUtil.get(locale,'medio.ambiente.general.more-info-about')} ${childCategory.getTitle(locale)}" 
163							                               				href="${categoryUrl}" >${languageUtil.get(locale,'medio.ambiente.general.more-info-about')} ${childCategory.getTitle(locale)}</a> 
164							                               		</div>	 
165							                               </div> 
166							                            </#if>	 
167													  
168												</div><#-- col-md-10 --> 
169				                            </div><#-- row --> 
170				                        </div><#-- categoria-asociada -->   
171				                    </#if> 			                    
172			                    </#if>             
173		                    </#if> 
174		               </#if> 	                     
175                </#if>   
176        	</#list> 
177 
178			<#-- Estamos en el segundo nivel, cuando la categoría actual es nieta --> 
179        	<#if cat_nivel_1 != 1 >	    
180        		<div class="categoria-asociada"> 
181                    <div class="row"> 
182                        <div class="col-md-2 categoria-imagen">                             
183		                    <#assign contenidoImagen = journalArticleService.getArticleContent(journalArticleCat, TPL_categoria_img_acceso, "VIEW", locale, themeDisplay)/> 
184		                    ${contenidoImagen}		 
185                        </div> 
186                        <div class="col-md-10">								 
187                            <#list childCategories as childCategory>		                            			 
188								<#if assetCategoryPropertyService.getCategoryProperty(childCategory.getCategoryId(),"idContenido") ? has_content > 
189			                        <#assign contentIdProperty = assetCategoryPropertyService.getCategoryProperty(childCategory.getCategoryId(),"idContenido")/> 
190			                        <#assign contentId = contentIdProperty.getValue()/> 
191			                        <#if contentId ? has_content> 
192				                            <#assign journalArticleSubSub = journalArticleService.getLatestArticle(groupId,contentId)/> 
193				                             <#if journalArticleSubSub.getStatus() == 0>	 
194					                            <#assign document = SAXReaderUtil.read(journalArticleSubSub.getContentByLocale(locale)) 
195													paginaDetalleNode =  document.selectSingleNode("/root/dynamic-element[@name='paginaDetalle']/dynamic-content") 
196													descripcionNode = document.selectSingleNode("/root/dynamic-element[@name='descripcion']/dynamic-content") 
197													titleNode = document.selectSingleNode("/root/dynamic-element[@name='texto']/dynamic-content") 
198													texto = HtmlUtil.stripHtml(titleNode.getText())	 
199		     										descripcion = HtmlUtil.stripHtml(descripcionNode.getText())													                      
200												/> 
201												 
202												<#if paginaDetalleNode?has_content && paginaDetalleNode.getText()?has_content> 
203													<#assign  pageDetail = paginaDetalleNode.getText()/> 
204													<#if (pageDetail?index_of("@")>0)> 
205														<#assign pageDetailPosition = (pageDetail?index_of("@")-1) 
206							 								pageDetail = pageDetail[0..pageDetailPosition] 
207							 								layoutDetail = layoutLocalService.getLayout(themeDisplay.getScopeGroupId(),false,pageDetail?number)					                          					  
208														/> 
209													</#if> 
210												<#else> 
211				                                    <#assign detailPage = "general" 
212				                                             layoutDetail = layoutLocalService.getFriendlyURLLayout(themeDisplay.getScopeGroupId(), false, "/"+detailPage) /> 
213												</#if> 
214												 
215												<#assign grandchildCategoryUrl = PortletURLFactoryUtil.create(request, "com_liferay_asset_categories_navigation_web_portlet_AssetCategoriesNavigationPortlet", layoutDetail.getPlid(), PortletRequest.RENDER_PHASE)/> 
216												${grandchildCategoryUrl.setParameter("categoryId", childCategory.getCategoryId()+"")}	 
217				 
218												<div class="col-md-6 articulo-relacionado"> 
219		                                        	<h4 class="title">${texto}</h4>                                                    
220		                                            <div class="summary">${descripcion}</div>                             
221		                                            <div class="link-more"> 
222				                               			<a class="more-information" title="${languageUtil.get(locale,'medio.ambiente.general.more-info-about')} ${childCategory.getTitle(locale)}" 
223				                               				href="${grandchildCategoryUrl}" >${languageUtil.get(locale,'medio.ambiente.general.more-info')}</a> 
224				                               		</div>	 
225		                                        </div>  
226		                                     </#if> 
227									</#if> 
228								</#if>								 
229                            
230							</#list> 
231								 
232						</div><#-- col-md-10 --> 
233                    </div><#-- row --> 
234                </div><#-- categoria-asociada -->    
235     
236	        	 
237	        
238				    		         
239	        </#if>                 
240        </div> 
241    </div>  
242<#-- No hay subcategorías, pintamos los contenidos de la categoría --> 
243<#else>             
244	<#assign TPL_articulo_listado = "173206" />   
245  	<div class="card flex-md-row mb-4 box-shadow h-md-250"> 
246      	<div class="card-body d-flex flex-column align-items-start navegacion-categorias">                      
247          	<h2 class="mb-0">${currentCategory.getTitle(locale)}</h2>   
248          	<#assign contentId = (assetCategoryPropertyService.getCategoryProperty(currentCategory.getCategoryId(), "idContenido").getValue())!""/> 
249			<#if contentId ? has_content>              	 
250                <#assign journalArticleSub = journalArticleService.getLatestArticle(groupId,contentId)/>  
251                	<#if journalArticleSub.getStatus() == 0>	 
252					<div class="categoria-asociada"> 
253						<div class="row">   
254	              			<div class="col-md-2 categoria-imagen">  
255	                            <#assign contenidoImagen = journalArticleService.getArticleContent(journalArticleSub, TPL_categoria_img_acceso, "VIEW", locale, themeDisplay)/> 
256			                    ${contenidoImagen}	                           	             
257	                    	</div> 
258	                    	<div class="col-md-10">	          
259								<#assign journalArticles = assetCategoriesCustomService.findJournalArticlesByCategoryId(currentCategory.getCategoryId(), groupId, structureArticulo, null, "title", "asc", null, null)/>             	 
260								 
261					            <#list journalArticles as journalArticle> 
262					            	<#assign document = SAXReaderUtil.read(journalArticle.getContentByLocale(locale))	 
263					                     currentUrl = renderResponse.createRenderURL() 
264					                     detailPage = "detalle" 
265			                         	 layoutDetail = layoutLocalService.getFriendlyURLLayout(themeDisplay.getScopeGroupId(), false, "/"+detailPage) 
266			                 			 detailUrl = PortletURLFactoryUtil.create(request, "com_liferay_asset_categories_navigation_web_portlet_AssetCategoriesNavigationPortlet", layoutDetail.getPlid(), PortletRequest.RENDER_PHASE) 
267			                 			 titulo = document.selectSingleNode("/root/dynamic-element[@name='titulo']/dynamic-content").getText()			                 			  
268					     			/>	  	      	        
269									${currentUrl.setParameter("categoryId",categoryId+"")} 
270									${detailUrl.setParameter("categoryId",currentCategory.getCategoryId()+"")} 
271									${detailUrl.setParameter("articleId", journalArticle.getArticleId())}																 
272										 
273									<#assign contenidoArticulo = journalArticleService.getArticleContent(journalArticle, TPL_articulo_listado, "VIEW", locale, themeDisplay)/> 
274					      			<div class="col-md-6 ${journalArticle?item_parity}"> 
275					                  	${contenidoArticulo}                                                                      
276					                  	<div class="link-more"> 
277					                  		<a class="more-information" title="${languageUtil.get(locale,'medio.ambiente.general.more-info-about')} ${titulo}" 
278					                  			href="${detailUrl}&articleId=${journalArticle.getArticleId()}&title=${HtmlUtil.escapeURL(titulo)}&redirect=${HtmlUtil.escapeURL(currentUrl)}">${languageUtil.get(locale,'medio.ambiente.general.more-info')}</a> 
279					              		</div> 
280					              	</div> 
281				            	</#list> 
282				            	<#-- ENLACES --> 
283				            	<#assign journalArticlesEnlaces = assetCategoriesCustomService.findJournalArticlesByCategoryId(currentCategory.getCategoryId(), groupId, structureEnlace, null, "title", "asc", null, null)/> 
284				            	<#if journalArticlesEnlaces ? has_content >            	 
285									<div class="col-md-12"> 
286										<h3 class="title">Web</h3> 
287										<ul> 
288								            <#list journalArticlesEnlaces as journalArticleEnlace>	 
289								            	<#assign documentEnlace = SAXReaderUtil.read(journalArticleEnlace.getContentByLocale(locale))	 
290						                 			 titulo = documentEnlace.selectSingleNode("/root/dynamic-element[@name='titulo']/dynamic-content").getText()			 
291						                 			 urlEnlace = "" 
292	                 		 						 nombreEnlace = "" 
293								     			/>	 
294							     				<#if documentEnlace.selectSingleNode("/root/dynamic-element[@name='urlEnlace']/dynamic-content") ? has_content> 
295													<#assign urlEnlaceNode = documentEnlace.selectSingleNode("/root/dynamic-element[@name='urlEnlace']/dynamic-content") 
296											         	 urlEnlace = urlEnlaceNode.getText() 
297											     		/> 
298										      	</#if>	  
299								               	<#if documentEnlace.selectSingleNode("/root/dynamic-element[@name='textoAlternativo']/dynamic-content") ? has_content> 
300													<#assign textoAlternativoNode = documentEnlace.selectSingleNode("/root/dynamic-element[@name='textoAlternativo']/dynamic-content") 
301											         	 textoAlternativo = textoAlternativoNode.getText() 
302											     		/> 
303										      	</#if>	  
304										      				 
305										      	<#assign nombreEnlace = titulo />									       
306											    <#if (textoAlternativo?? && textoAlternativo != "")>										    	 
307													 <#assign nombreEnlace = textoAlternativo /> 
308												</#if>							  	      	        
309												 
310												<li>			 
311													<a class="popup" target="_blank" href="${urlEnlace}"  
312														title="${nombreEnlace}. <@liferay.language key="medio.ambiente.general.external-link" />">${nombreEnlace}</a> 
313												</li>	 
314							            	</#list> 
315						            	</ul> 
316						            </div> 
317						        </#if>				            	         
318				            </div>    
319						</div> 
320					</div> 
321				</#if> 
322			</#if>	 
323        </div> 
324    </div>    	 
325</#if> 

Navegador por categorías personalizado

Publicador de contenidos

Publicador de contenidos

Se ha producido un error al procesar la plantilla.
Java method "com.sun.proxy.$Proxy75.getAssetCategory(long)" threw an exception when invoked on com.sun.proxy.$Proxy75 object "com.liferay.portlet.asset.service.impl.AssetCategoryLocalServiceImpl@5aeef38f"; see cause exception in the Java stack trace.

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign category = assetCategoryServi...  [in template "646115#646149#789946" at line 7, column 1]
----
1<#assign assetCategoryService =  serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService") 
2		 ParamUtil = staticUtil["com.liferay.portal.kernel.util.ParamUtil"] 
3         curCategoryId =ParamUtil.getLong(renderRequest,"categoryId", 0)  
4         PropsUtil = staticUtil["com.liferay.portal.kernel.util.PropsUtil"]          
5 /> 
6         
7<#assign category = assetCategoryService.getAssetCategory(curCategoryId)/>  
8	                                    
9<div class="caja-redonda normal">			 
10	<h3><@liferay.language key="medio.ambiente.category.more-information"/></h3>	 
11 
12	<ul> 
13		<li>  
14			<a href="/categorias-publicaciones/-/categories/${category.getCategoryId()}"  
15				title="<@liferay.language key="medio.ambiente.publicacion.de"/> ${category.getTitle(locale)}"><@liferay.language key="medio.ambiente.publicacion.publicaciones"/></a>  
16		</li> 
17		<li><a href="/categorias-enlaces/-/categories/${category.getCategoryId()}"  
18				title="<@liferay.language key="medio.ambiente.enlace.de"/> ${category.getTitle(locale)}"> <@liferay.language key="medio.ambiente.enlace.enlaces"/></a> 
19		</li> 
20	</ul> 
21</div>