Um erro ocorreu enquanto processava o modelo.
Java method "static com.liferay.asset.kernel.service.AssetCategoryLocalServiceUtil.getAssetCategory(long)" couldn't be called: The value of the 1st argument was null, but the target Java parameter type (long) is primitive and so can't store null. ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign category = assetCategoryLocal... [in template "15553970#15554109#17210299" at line 36, column 1] ----
1<#-- OBTENER CONTENIDOS CON LA CATEGORIA PASADA -->
2
3
4
5<#assign listCategoriesFilter = []>
6<#if request.getParameter("categoryId")??>
7 <#assign listCategoriesFilter = [request.getParameter("categoryId")?number]>
8</#if>
9<#assign pageNumber = 1>
10<#if request.getParameter("page")??>
11 <#assign pageNumber = request.getParameter("page")?number>
12</#if>
13
14<#assign delta = portletPreferences["delta"][0]?number>
15<#assign end = pageNumber * delta>
16<#assign start = end - delta>
17
18<#assign JournalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService")>
19<#assign assetEntryQueryService = objectUtil('com.liferay.asset.kernel.service.AssetEntryLocalServiceUtil')>
20<#assign assetEntryQuery = objectUtil('com.liferay.asset.kernel.service.persistence.AssetEntryQuery')>
21<#assign search = assetEntryQuery.setAllCategoryIds(listCategoriesFilter)>
22<#assign searchStart = assetEntryQuery.setStart(start)>
23<#assign searchEnd = assetEntryQuery.setEnd(end)>
24<#assign listEntries = assetEntryQueryService.getEntries(assetEntryQuery)>
25<#assign listEntriesSize = assetEntryQueryService.getEntriesCount(assetEntryQuery)>
26
27<#assign totalPages = (listEntriesSize/delta)?int>
28
29<#if listEntriesSize%delta != 0>
30 <#assign totalPages = totalPages + 1>
31</#if>
32
33<#assign assetCategoryLocalServiceUtil = staticUtil["com.liferay.asset.kernel.service.AssetCategoryLocalServiceUtil"]/>
34<#assign assetCategoryPropertyLocalServiceUtil = staticUtil["com.liferay.asset.kernel.service.AssetCategoryPropertyLocalServiceUtil"]/>
35<#assign assetVocabularyLocalServiceUtil = staticUtil["com.liferay.asset.kernel.service.AssetVocabularyLocalServiceUtil"]/>
36<#assign category = assetCategoryLocalServiceUtil.getAssetCategory(listCategoriesFilter[0])/>
37<#assign titleCategory = category.getName() />
38<#assign vocabulary = assetVocabularyLocalServiceUtil.getAssetVocabulary(category.vocabularyId) />
39
40<#attempt>
41 <#assign cat = assetCategoryPropertyLocalServiceUtil.getCategoryProperties(category.categoryId)/>
42 <#assign headerImg = "">
43 <#if categories ??>
44 <#list cat as category>
45 <#if category.key == "image">
46 <#assign categoryImg = assetCategoryPropertyLocalServiceUtil.getCategoryProperty(category.getCategoryId(),"image")/>
47 <#assign headerImg = categoryImg.getValue()?replace('_', '/')>
48 </#if>
49 </#list>
50 </#if>
51
52<#recover>
53 <#assign headerImg = "">
54</#attempt>
55
56<#attempt>
57 <#if vocabulary.name?contains("Centro")>
58 <div class="tituloCategoria">
59 PUBLICACIONES DEL ${titleCategory}
60 </div>
61 <#else>
62 <div class="tituloCategoria">
63 PUBLICACIONES DE ${titleCategory}
64 </div>
65 </#if>
66<#recover>
67</#attempt>
68
69<#assign counter = 0>
70<div class="row">
71
72 <#list listEntries as curEntry>
73 <#assign viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, curEntry, true) />
74
75 <#assign renderer = curEntry.getAssetRenderer()>
76 <#assign className = renderer.getClassName()>
77
78
79
80 <#if className == "com.liferay.journal.model.JournalArticle">
81 <#assign journalArticle = renderer.getArticle()>
82 <#assign jaResourcePrimKey = journalArticle.getResourcePrimKey()>
83 <#assign reproducciones = journalArticle.getExpandoBridge().getAttribute('reproducciones')>
84 <#assign document = saxReaderUtil.read(journalArticle.getContent())>
85 <#assign rootElement = document.getRootElement()>
86 <#assign defaultLanguageId = parseXml ("@default-locale", rootElement)>
87
88 <#assign title = getField("Título", locale, defaultLanguageId, rootElement)!>
89 <#assign imgUrl = "">
90 <#attempt>
91 <#assign xPathSelector = saxReaderUtil.createXPath("dynamic-element[@name='imagen']")>
92 <#if xPathSelector.selectSingleNode(rootElement)??>
93 <#assign img = xPathSelector.selectSingleNode(rootElement).getStringValue()>
94 <#if isJson(img)>
95 <#assign imgJson = jsonFactoryUtil.createJSONObject(img)>
96 <#assign imgUrl = "/documents/" + imgJson.groupId + "/" + imgJson.uuid >
97 </#if>
98 </#if>
99 <#recover>
100 <#assign imgUrl = "">
101 </#attempt>
102
103 <#if counter = 0 && headerImg == "">
104 <#assign headerImg = imgUrl>
105 </#if>
106
107 <#attempt>
108 <#assign xPathSelector = saxReaderUtil.createXPath("dynamic-element[@name='ArchivoDeAudioVideo']")>
109 <#assign audioVideoUrl = "">
110 <#if xPathSelector.selectSingleNode(rootElement)??>
111 <#assign audioVideo = xPathSelector.selectSingleNode(rootElement).getStringValue()>
112 <#if isJson(audioVideo)>
113 <#assign audioVideoJson = jsonFactoryUtil.createJSONObject(audioVideo)>
114 <#assign audioVideoUrl = "/documents/" + audioVideoJson.groupId + "/" + audioVideoJson.uuid >
115 </#if>
116 </#if>
117
118 <#recover>
119 <#assign audioVideoUrl = "">
120 </#attempt>
121
122 <div class="col-xs-12 col-sm-6 col-md-4">
123 <div class="latest-publications-card publications-card">
124 <div class="latest-publications-header">
125 <div class="header-img">
126 <img loading="lazy" decoding="async" src="${imgUrl}" width="370" height="290" alt="Serie image">
127 </div>
128 <div class="header-content">
129 <div class="actions-cont">
130 <div class="actions">
131 <a class="jPlayerPlay" url="${audioVideoUrl}" title="${title}" id="${jaResourcePrimKey}" counter="${reproducciones}">
132 <i class="play icon-play"></i>
133 </a>
134 </div>
135 </div>
136 </div>
137 </div>
138 <div class="latest-publications-content">
139 <h5 class="title"><a href="${viewURL}">${title}</a></h5>
140 </div>
141 </div>
142 </div>
143 </#if>
144 <#assign counter = counter + 1>
145
146 </#list>
147
148</div>
149<div class="row">
150 <div class="col-md-12">
151 <div class="pagination-educastur-radio">
152 <#list 1..totalPages as index>
153 <#if index == 1 && index != pageNumber >
154 <a class="prev page-numbers" href="${'/web/guest/publicaciones-categoría?categoryId=' + category.getCategoryId() + '&page=' + (pageNumber - 1) }">
155 <span class="icon-l">
156 <i class="icon-angle-left"></i>
157 Anterior
158 </span>
159 </a>
160 <a class="page-numbers current" href="${'/web/guest/publicaciones-categoría?categoryId=' + category.getCategoryId() + '&page=' + index }">
161 <span class="num">${index}</span>
162 </a>
163 <#elseif index == totalPages && index != pageNumber>
164 <a class="page-numbers current" href="${'/web/guest/publicaciones-categoría?categoryId=' + category.getCategoryId() + '&page=' + index }">
165 <span class="num">${index}</span>
166 </a>
167 <a class="next page-numbers" href="${'/web/guest/publicaciones-categoría?categoryId=' + category.getCategoryId() + '&page=' + (pageNumber + 1) }">
168 <span class="icon-r">
169 Siguiente
170 <i class="icon-angle-right"></i>
171 </span>
172 </a>
173 <#elseif index == pageNumber>
174 <span class="page-numbers current">
175 <span class="num">${index}</span>
176 </span>
177 <#elseif index gte (pageNumber - 2) && index lte (pageNumber + 2) >
178 <#if index == (pageNumber - 2)>
179 <span class="page-numbers dots">...</span>
180 </#if>
181 <a class="page-numbers current" href="${'/web/guest/publicaciones-categoría?categoryId=' + category.getCategoryId() + '&page=' + index }">
182 <span class="num">${index}</span>
183 </a>
184 <#if index == (pageNumber + 2)>
185 <span class="page-numbers dots">...</span>
186 </#if>
187 </#if>
188 </#list>
189 </div>
190 </div>
191</div>
192
193
194
195<#function getField field languageId defaultLanguageId xml>
196 <#local defaultSelector = "//dynamic-content[@language-id='" + defaultLanguageId + "' and ancestor-or-self::*[@name='" + field + "']]">
197 <#local localeSelector = "//dynamic-content[@language-id='" + languageId + "' and parent::*[@name='" + field + "']]">
198
199 <#local selector = saxReaderUtil.createXPath(localeSelector)>
200 <#local value = selector.selectSingleNode(xml)!>
201
202 <#if value?has_content && value.getText()?has_content>
203 <#return value.getText()>
204 </#if>
205
206 <#local selector = saxReaderUtil.createXPath(defaultSelector)>
207 <#local value = selector.selectSingleNode(xml)!>
208
209 <#if value?has_content && value.getText()?has_content>
210 <#return value.getText()>
211 </#if>
212
213 <#return "">
214</#function>
215
216<#function parseXml xpath xml>
217 <#local selector = saxReaderUtil.createXPath(xpath)>
218 <#local result = selector.selectSingleNode(xml)!>
219
220 <#if result?has_content>
221 <#return result.getStringValue()>
222 </#if>
223
224 <#return "">
225</#function>
226
227<#function isJson json>
228 <#local value = json?trim>
229 <#return value?has_content && value?starts_with("{") && value?ends_with("}")>
230</#function>
231
232<script>
233 $(".js_title").html("${titleCategory}");
234 $(".js_counter_elements").html(${listEntriesSize} + " resultados / página " + ${pageNumber} + " de " + ${totalPages});
235 $(".js_img").attr("src","${headerImg}");
236</script>