Categorias - Info Video
Se ha producido un error al procesar la plantilla.
Java method "com.sun.proxy.$Proxy50.getCategory(long)" threw an exception when invoked on com.sun.proxy.$Proxy50 object "com.liferay.asset.categories.internal.service.AssetCategoryPropertyAssetCategoryLocalServiceWrapper@4b2e2cac"; see cause exception in the Java stack trace.
----
FTL stack trace ("~" means nesting-related):
- Failed at: categoria = assetCategoryLocalService... [in template "20097#20123#2126721" at line 35, column 17]
----
1<#assign
2 assetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService")
3 assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService")
4 categoriasServ = serviceLocator.findService("com.ss.infv.library.service.CategoriasServ")
5/>
6<#--------------------------------------------------->
7<#-- MENU DE SUBCATEGORIAS ---->
8<#--------------------------------------------------->
9
10
11<#assign parentCategoryId = paramUtil.getInteger(request, "_com_liferay_asset_categories_navigation_web_portlet_AssetCategoriesNavigationPortlet_INSTANCE_general_parentCategoryId",-1) />
12<#assign selectedCategory = 0 />
13<#assign hayDestacados=true >
14
15
16<#if (parentCategoryId<0) >
17 <#assign
18 plid="_" + themeDisplay.getPortletDisplay().getId()
19 parentCategoryId=paramUtil.getInteger(request, plid + "_parentCategoryId",-1) />
20 <#if (parentCategoryId<0) >
21 <#assign parentCategoryId =paramUtil.getInteger(request, "p_r_p_categoryId",-1) />
22 </#if>
23</#if>
24
25
26<#assign categoryId = paramUtil.getInteger(request, "p_r_p_categoryId", -1) />
27
28<#-- Variable que se carga en el detalle del video, para poder volver con la categoria seleccionada -->
29 <#assign p_r_p_categoryIdPath = paramUtil.getInteger(request, "p_r_p_categoryIdPath", -1) />
30
31
32 <#if (categoryId>0) >
33
34 <#assign
35 categoria = assetCategoryLocalService.getCategory(parentCategoryId)
36 parentId = categoria.getParentCategoryId()
37 hijos = assetCategoryLocalService.getChildCategories(parentCategoryId)
38
39 />
40
41
42 <div class="row">
43 <h2 class="pinfv_categorias-title">${categoria.getDescriptionCurrentValue()}</h2>
44 </div>
45
46 <div class="row">
47 <nav class="navbar navbar-expand navbar-underline navigation-bar pinfv_categorias_navbar pinfv-nav-category w-100">
48
49 <!------------------------------------------------------------->
50 <!---------------- CARRUSEL DE IMAGENES ----------------------->
51 <!------------------------------------------------------------->
52
53 <!-- En caso de que se este mostrando la categoria de nivel 1 es la opcion de destacado, se ejecuta filtro. -->
54 <#assign categoryIdAux= categoryId />
55 <#if p_r_p_categoryIdPath gte 0>
56 <#assign categoryIdAux =p_r_p_categoryIdPath />
57 </#if>
58
59 <#assign activarFirstCategoria=false>
60 <#if (categoryIdAux==parentCategoryId) >
61 <#list entries?filter(esDestacado) as newEntrys></#list>
62 <#assign entriesDestacado = entries?filter(esDestacado) >
63 <#-- si no hay destacados no filtro los datos, porque los tengo que mostrar bajo la categoria adecuada -->
64 <#if (entriesDestacado?size == 0) >
65 <#assign hayDestacados=false >
66 <#-- Si se entra por categoria principal, y no hay descatados, mostramos como activo la primera categoria -->
67 <#assign activarFirstCategoria=true >
68 <#else>
69 <#-- Si hay destacados dejo los destacados que hay y no activamos la primera categoria-->
70 <#assign hayDestacados=true >
71 <#assign entries = entriesDestacado >
72 <#assign activarFirstCategoria=false >
73 </#if>
74
75 <#else>
76 <#-- Si la pestaña actual no es la principal, se ejecuta a ver si hay destacados en general -->
77 <!-- Busco por base de datos ya que si venimos de una categoria hija, los datos los tendremos filtrados y no sabremos si en el resto de categorias hay hijos -->
78 <#assign hayDestacados=categoriasServ.tieneDestacados(parentCategoryId) />
79
80 </#if>
81 <!-- trazas en codido fuente
82 hayDestacados : <#if hayDestacados > true <#else> false </#if> <br>
83 activarFirstCategoria : <#if activarFirstCategoria > true <#else> false </#if> <br>
84 -->
85
86 <div class="container-fluid container-fluid-max-xl">
87 <#assign categoryURL = renderResponse.createRenderURL()
88 currentCategory = parentCategoryId == categoryId
89 currentCategoryPath = (p_r_p_categoryIdPath< 0 ) || (p_r_p_categoryIdPath==parentCategoryId)
90 />
91
92 ${categoryURL.setParameter("resetCur", "true")}
93 ${categoryURL.setParameter("categoryId", parentCategoryId?string)}
94 ${categoryURL.setParameter("parentCategoryId", parentCategoryId?string)}
95
96 <ul class="navbar-nav pinfv_categorias_nav flex-nowrap">
97 <#if (hayDestacados) >
98 <li class="nav-item pinfv_categorias_nav_item text-nowrap">
99 <a href="${categoryURL}" class="nav-link pinfv_categorias_nav_item-link
100 <#if (currentCategory&¤tCategoryPath) >active</#if>">
101 <@liferay_ui.message key="infv.wt.carrousel.destacado" />
102
103 </a>
104 </li>
105
106 </#if>
107
108 <#if hijos?has_content>
109 <#-- guardamos la categoria Seleccionada, que puede ser la primera categoria ( en caso de entrar por categoria principal) -->
110 <#assign selectedCategory = (hijos?first).getCategoryId() />
111
112 <#list hijos as hijo>
113 <#assign currentCategory = categoryId == hijo.getCategoryId() />
114 <#assign currentCategoryPath = p_r_p_categoryIdPath == hijo.getCategoryId() />
115
116 <#if (currentCategory||currentCategoryPath)>
117 <#assign selectedCategory = hijo.getCategoryId() />
118 </#if>
119
120 <li class="nav-item pinfv_categorias_nav_item text-nowrap">
121 ${categoryURL.setParameter("resetCur", "true")}
122 ${categoryURL.setParameter("categoryId", hijo.getCategoryId()?string)}
123 ${categoryURL.setParameter("parentCategoryId", parentCategoryId?string)}
124 <#assign activar="">
125 <#if (currentCategory||currentCategoryPath)>
126 <#assign activar="active">
127 </#if>
128
129 <#if (hijo?is_first) && (activarFirstCategoria)>
130 <#assign activar="active">
131 </#if>
132
133 <a href="${categoryURL}" class="pinfv_categorias_nav_item-link nav-link ${activar}">${hijo.getDescriptionCurrentValue()}</a>
134
135 </li>
136 </#list>
137 <#else>
138 <#assign selectedCategory = 0 />
139 </#if>
140
141 </ul>
142 </div>
143 </nav>
144 </div>
145 </#if>
146
147 <!-- selectedCategory ${selectedCategory} -->
148
149<#if entries?has_content>
150 <div id="carouselVideos-${randomNamespace}" class="pinfv_categorias_grid mt-5">
151 <#list entries as entry>
152 <#if entry.getClassName() == "com.liferay.journal.model.JournalArticle">
153 <#assign
154 assetRenderer = entry.getAssetRenderer()
155 article = assetRenderer.getArticle()
156 categoriasEntry= entry.getCategoryIds()
157 />
158
159
160 <!-- Contiene : ${categoriasEntry?seq_index_of(selectedCategory)} -->
161 <!-- <#list categoriasEntry as ce>
162 <br>${ce}<br>
163 </#list> -->
164 <#-- En caso de haber entrada por la categoria principal y que no haya destacados, en la variable de entries tendremos todos los articulos
165 asi que filtramos, para mostrar solo los articulos de la primera subcategoria, que será la subcategoria que vamos a destacar.
166 Si embargo si hay destacados, mostramos los destacados sin tener en cuenta a que subcategoria pertenece.
167 -->
168 <#if ((categoriasEntry?seq_index_of(selectedCategory) gte 0)) || (hayDestacados) >
169 <@liferay_journal["journal-article"]
170 articleId=article.getArticleId()
171 ddmTemplateKey="INFV-PLANTILLA-LISTADO"
172 groupId=article.getGroupId()
173 />
174 </#if>
175 </#if>
176 </#list>
177
178 </div>
179</#if>
180
181
182<#-- Funcion que recupera el campo destacado del articulo. -->
183<#function esDestacado entrada>
184 <#assign mostrar=true />
185 <#assign
186 assetRenderer = entrada.getAssetRenderer()
187 ddmFormValuesReader = assetRenderer.getDDMFormValuesReader()
188 ddmFormValues = ddmFormValuesReader.getDDMFormValues()
189 mapDDMFormFieldValue = ddmFormValues.getDDMFormFieldValuesMap()
190
191 />
192 <#if mapDDMFormFieldValue["destacado"]?has_content >
193 <#assign ddmValues=mapDDMFormFieldValue["destacado"] />
194 <#else/>
195 <#assign mostrar= false />
196 <#return mostrar>
197
198 </#if>
199
200
201 <#list ddmValues as v>
202 <#assign
203 value=v.getValue()
204 destacado= value.getString(value.getDefaultLocale())
205 />
206 </#list>
207 <#if destacado?has_content >
208 <#assign mostrar= destacado?boolean />
209 </#if>
210 <#return mostrar>
211
212</#function>