angle-left Boktips från bibblan
Fel uppstod under bearbetning av mallen.
Java method "com.sun.proxy.$Proxy466.getArticle(long, String)" threw an exception when invoked on com.sun.proxy.$Proxy466 object "com.liferay.journal.service.impl.JournalArticleLocalServiceImpl@2569cf0a"; see cause exception in the Java stack trace.

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign journalArticle = journalArtic...  [in template "907863#907897#284013" at line 51, column 1]
----
1<#-- STAFF PICKS TEMPLATE --> 
2<#--Settings needed for local REST API call --> 
3<#assign portalSiteID = "" /><#-- Portal side id needed to query records --> 
4<#assign agencyID = "493222570" /><#-- 493222570 Agency ID needed for cover fetching. Can be obtained e.g. from SOLR --> 
5<#assign agencyMemberID = "" /> 
6<#assign agencyName = "" /><#-- Needed for cover fetching --> 
7<#assign portNumber = "16520" /><#-- Needed for all API calls --> 
8<#assign queryLimit = 8 /><#-- Limits how many records are shown at maximum in list view --> 
9<#assign portalUrl = "" /> 
10<#assign portalUrlSecure = "" /><#-- Used for fetching covers and get rid of mixed content warning --> 
11<#assign csAddress = "http://arena-central" /> <#-- used to be arena-central:16517 --> 
12<#assign lsAddress = "http://arena-local:16520" /> 
13<#assign friendlyUrl = "" /> 
14<#assign sitePrefix = "/web/arena" /> 
15 
16<#-- If friendlyUrl is not set, get it from the organization --> 
17<#if friendlyUrl == "" > 
18    <#assign groupLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.GroupLocalService")/> 
19    <#assign group = groupLocalService.getGroup(groupId)/> 
20    <#assign friendlyUrl = group.getFriendlyURL() /> 
21    <#assign sitePrefix = "/web${friendlyUrl}" /> 
22</#if> 
23 
24<#-- Get server and page URLs --> 
25<#assign serviceContext = staticUtil["com.liferay.portal.kernel.service.ServiceContextThreadLocal"].getServiceContext() /> 
26<#assign themeDisplay = serviceContext.getThemeDisplay() /> 
27<#assign portalUrl = themeDisplay.getPortalURL() /> 
28<#assign portalUrlSecure = portalUrl /> 
29<#if portalUrlSecure?index_of("https") == -1> 
30    <#assign portalUrlSecure = portalUrl?replace("http", "https") /> 
31</#if> 
32<#if portalUrl?index_of("https") != -1> 
33    <#assign portalUrl = portalUrl?replace("https", "http") /> 
34</#if> 
35 
36<#assign virtualURL = portalUrlSecure?replace("https://","") /> 
37 
38<#assign fullPageUrl = portalUrl + themeDisplay.getURLCurrent() /> 
39<#assign urlMatcher = themeDisplay.getURLCurrent()?matches("^(/[a-z]{2}(_[A-Z]{2})?)?/web/[^/]+")> 
40<#list urlMatcher as algFriendlyUrl> 
41    <#assign crdPageUrl = portalUrlSecure + algFriendlyUrl + "/results"/> 
42    <#assign searchPageUrl = portalUrlSecure + algFriendlyUrl + "/search"/> 
43</#list> 
44<#assign crdPageUrl = portalUrlSecure + "/results"/> 
45<#assign searchPageUrl = portalUrlSecure + "/search"/> 
46 
47<#-- General variables needed in multiple macros --> 
48<#assign journalArticleResourceService = serviceLocator.findService("com.liferay.journal.service.JournalArticleResourceLocalService") /> 
49<#assign articleResourcePK = journalArticleResourceService.getArticleResourcePrimKey(groupId, .vars['reserved-article-id'].data)?number /> 
50<#assign journalArticleService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") /> 
51<#assign journalArticle = journalArticleService.getArticle(groupId, .vars['reserved-article-id'].data) /> 
52 
53<#--Makes a query to the REST API and requests records. This function should be used to call the API within this template. 
54Returns the result as a simpleHash object --> 
55<#function queryAPI query limit> 
56    <#assign fullRequestUrl = "${lsAddress}/local-rest/api/v1/portalsites/${portalSiteID}/records?query=${httpUtilUnsafe.encodeURL(query)}&count=${limit}&isShowExtended=false&sortDirection=Descending&sortField=Relevance&agencyMemberId=${agencyMemberID}&decorationNames=Ratings"/> 
57    <#assign response = httpUtilUnsafe.URLtoString(fullRequestUrl) /> 
58    <#assign result = jsonFactoryUtil.looseDeserialize(response) /> 
59    <#return result /> 
60</#function> 
61 
62<#-- Makes a query to Central REST API to get portal site settings --> 
63<#function getPortalSiteSettingsFromCentralService> 
64    <#assign requestUrlPortalSites = "${csAddress}/central-rest/api/v1/configs/portalsites?vhost=${httpUtilUnsafe.encodeURL(virtualURL)}&friendlyUrl=${httpUtilUnsafe.encodeURL(friendlyUrl)}" /> 
65    <#assign response = httpUtilUnsafe.URLtoString(requestUrlPortalSites) /> 
66    <#assign result = jsonFactoryUtil.looseDeserialize(response) /> 
67    <#return result /> 
68</#function> 
69 
70<#-- Makes a query to Central REST API to get Member settings to extract Agency ID from --> 
71<#function getAgencySettingsFromCentralService> 
72    <#assign requestUrlMemberAgencies = "${csAddress}/central-rest/api/v1/configs/agencymembers/${agencyMemberID}" /> 
73    <#assign response = httpUtilUnsafe.URLtoString(requestUrlMemberAgencies) /> 
74    <#assign result = jsonFactoryUtil.looseDeserialize(response) /> 
75    <#return result /> 
76</#function> 
77 
78<#function getServerSettingsFromCentralService> 
79    <#assign portalSites = "" /> 
80    <#assign returnValue = "OK" /> 
81    <#assign portalSites = "" /> 
82    <#assign memberData = "" /> 
83    <#assign favoriteAgencyName = "" /> 
84    <#attempt> 
85        <#assign portalSites = getPortalSiteSettingsFromCentralService() /> 
86        <#if portalSites.id??> 
87            <#assign portalSiteID = portalSites.id?string /> 
88            <#assign favoriteAgencyName = portalSites.mainGroup.properties["Favourite Agency Member"] /> 
89        <#else> 
90            <#assign requestUrlPortalSites = "${csAddress}/central-rest/api/v1/configs/portalsites?vhost=${httpUtilUnsafe.encodeURL(virtualURL)}&friendlyUrl=${httpUtilUnsafe.encodeURL(friendlyUrl)}" /> 
91            <#assign response = httpUtilUnsafe.URLtoString(requestUrlPortalSites) /> 
92        </#if> 
93        <#if favoriteAgencyName != ""> 
94        <#-- Go through portalSites.agencyMemberSummaries to find the one with matching favoriteAgencyName --> 
95            <#list portalSites.agencyMemberSummaries as summary> 
96                <#if summary.name == favoriteAgencyName> 
97                    <#assign agencyMemberID = summary.id?string /> 
98                </#if> 
99            </#list> 
100        </#if> 
101        <#recover> 
102            <#assign returnValue =  "Portal Sites failed" /> 
103    </#attempt> 
104    <#if agencyMemberID != "" && returnValue == "OK"> 
105        <#attempt> 
106            <#assign memberData = getAgencySettingsFromCentralService() /> 
107            <#if memberData.agency??> 
108                <#assign agencyID = memberData.agency.id /> 
109                <#assign agencyName = memberData.agency.name /> 
110            </#if> 
111            <#recover> 
112                <#assign returnValue =  "Agency member data failed" /> 
113        </#attempt> 
114    </#if> 
115 
116    <#return returnValue /> 
117</#function> 
118 
119 
120<#macro debugServerInfo> 
121    <div class="serverInfo hidden debug informative"> 
122        <p class="idsForRestAPI"> 
123            <strong>Portal Site ID:</strong> ${portalSiteID}<br /> 
124            <strong>Agency ID:</strong> ${agencyID}<br /> 
125            <strong>Agency name:</strong> ${agencyName}<br /> 
126            <strong>Member ID:</strong> ${agencyMemberID} 
127 
128        </p> 
129        <p class="serverURL"> 
130            <strong>Portal site URL:</strong> ${portalUrl}<br /> 
131            <strong>Portal site URL Secure:</strong> ${portalUrlSecure}<br /> 
132            <strong>Virtual URL:</strong> ${virtualURL}<br /> 
133            <strong>Friendly URL:</strong> ${friendlyUrl} 
134        </p> 
135    </div> 
136</#macro> 
137 
138<#-- Outputs a hidden debug tag with information. --> 
139<#macro debugthis title message link isinformative> 
140    <#assign cssClass = "hidden debug" /> 
141    <#if isinformative> 
142        <#assign cssClass = "hidden debug informative" /> 
143    </#if> 
144    <div class="${cssClass}"> 
145        <h4>Debug - ${title}</h4> 
146        <#if link == ""> 
147            <p>${message}</p> 
148        <#else> 
149            <p><a href="${link}">${message}</a></p> 
150        </#if> 
151    </div> 
152</#macro> 
153 
154<#macro showTags> 
155    <#assign tagsService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetTagLocalService") /> 
156    <#assign tagsAsset = tagsService.getTags("com.liferay.journal.model.JournalArticle", articleResourcePK) /> 
157 
158<#-- Services for tag links --> 
159    <#assign layoutUid = journalArticle.getLayoutUuid() /> 
160 
161    <h3><@liferay.language key="staffpicks.detail.header.tags" /></h3> 
162    <@debugthis title="tags" message="Tag links don't work yet." isinformative=true link="" /> 
163    <@debugthis title="tags" message=layoutUid isinformative=true link="" /> 
164    <ul class="staffpick-article-tags"> 
165        <#list tagsAsset as tag> 
166            <#assign tagNameLink = tag.getName() /> 
167            <li class="staffpick-article-tagentry"><a class="staffpicks-article-tag-link" href="${sitePrefix}/-/tag/${tagNameLink}">${tagNameLink}</a></li> 
168        </#list> 
169    </ul> 
170</#macro> 
171 
172<#macro showArticleAuthor> 
173    <#if articleAuthor?? && articleAuthor.getData() != ""> 
174        <p class="staffpick-article-author-name"> 
175            <@liferay.language_format key="staffpicks.detail.articleauthor" arguments=[articleAuthor.getData()] /> 
176            <#--${languageUtil.format(locale, "staffpicks.detail.articleauthor", [articleAuthor.getData()])}--> 
177        </p> 
178    </#if> 
179</#macro> 
180 
181<#macro showDate dateString> 
182    <#assign originalLocale = locale /> 
183    <#setting locale = localeUtil.getDefault() /> 
184    <#assign time = dateString?datetime("EEE, dd MMM yyyy hh:mm:ss ZZZZ") /> 
185    <#setting locale = originalLocale /> 
186    <#assign dateFormat = "dd MMM yyyy" /> 
187    <#if stringUtil.equals(locale, "en_US")> 
188        <#assign dateFormat = "MM/dd/yyyy" /> 
189    <#elseif stringUtil.equals(locale, "en_GB")> 
190        <#assign dateFormat = "MMM d yyyy" /> 
191    <#elseif stringUtil.equals(locale, "de_DE")> 
192        <#assign dateFormat = "dd.MM.yy" /> 
193    <#elseif stringUtil.equals(locale, "fi_FI")> 
194        <#assign dateFormat = "d.M.yy" /> 
195    <#elseif stringUtil.equals(locale, "fr_FR")> 
196        <#assign dateFormat = "dd/MM/yy" /> 
197    <#elseif stringUtil.equals(locale, "nb_NO")> 
198        <#assign dateFormat = "dd.MM.yy" /> 
199    <#elseif stringUtil.equals(locale, "ru_FI")> 
200        <#assign dateFormat = "dd.MM.yy" /> 
201    <#elseif stringUtil.equals(locale, "sv_SE")> 
202        <#assign dateFormat = "yyyy-MM-dd" /> 
203    </#if> 
204    ${dateUtil.getDate(time, dateFormat, locale)} 
205</#macro> 
206 
207<#macro showRecord recordInfo> 
208<#-- Arena 4 CRD link --> 
209    <#assign crdPageFullUrl = "${crdPageUrl}?p_p_id=crDetailWicket_WAR_arenaportlet&p_p_lifecycle=1&p_p_state=normal&p_r_p_arena_urn%3Aarena_search_item_id=${recordInfo.id}&p_r_p_arena_urn%3Aarena_agency_name=${agencyName}" /> 
210 
211    <li class="similar-record record-${recordInfo.id}"> 
212        <@debugthis title="Record" message="ID: ${recordInfo.id}" link="" isinformative=true /> 
213        <a class="similar-record-link" href="${crdPageFullUrl}"> 
214            <img class="similar-record-cover" src="${portalUrlSecure}/local-rest/api/v1/portalsites/${portalSiteID}/agencies/${agencyID}/records/${httpUtilUnsafe.encodeURL(recordInfo.id)}/cover" alt="" /> 
215            <span class="similar-record-title">${recordInfo.fields.title}</span> 
216            <#if recordInfo.fields.authors?? && recordInfo.fields.authors?size gt 0 && recordInfo.fields.authors[0]??> 
217            <span class="similar-record-author">${recordInfo.fields.authors[0].name} 
218                </#if> 
219        </a> 
220        <#if recordInfo.rating??> 
221            <@showRatings rating=recordInfo.rating recordtitle=recordInfo.fields.title /> 
222        </#if> 
223    </li> 
224</#macro> 
225 
226<#macro showRatings rating recordtitle> 
227    <#assign ratingFive = (rating/2) /> 
228    <#assign ratingLimit = 5 /> 
229    <div class="staffpicks-rating"> 
230        <#assign ratingFiveString = ratingFive?string.number /> 
231        <#list 1..ratingLimit as x> 
232            <#if (x-0.5) == ratingFive> 
233                <span class="arena-rating rating-half-full"><i class="icon-star-half-full"></i></span> 
234            <#elseif x <= ratingFive> 
235                <span class="arena-rating rating-full"><i class="icon-star"></i></span> 
236            <#else> 
237                <span class="arena-rating rating-empty"><i class="icon-star-empty"></i></span> 
238            </#if> 
239        </#list> 
240    </div> 
241</#macro> 
242 
243<#macro showSimilarRecords result> 
244    <h3><@liferay.language key="staffpicks.detail.header.similartitles" /></h3> 
245    <#assign searchString = "" /> 
246    <#attempt> 
247        <#if result.fields.subjects?size gt 0> 
248            <#assign searchString = searchString + "(" /> 
249            <#list result.fields.subjects as subject> 
250                <#assign searchString = searchString + "subject:\"${subject}\"" /> 
251                <#if subject_index < result.fields.subjects?size-1> 
252                    <#assign searchString = searchString + " OR " /> 
253                </#if> 
254            </#list> 
255            <#assign searchString = searchString +") AND (" /> 
256        <#else> 
257            <#assign searchString = searchString +"(" /> 
258        </#if> 
259        <#recover> 
260    </#attempt> 
261    <#attempt> 
262        <#if result.fields.languages?size gt 0> 
263            <#list result.fields.languages as language> 
264                <#assign searchString = searchString + "language:\"${language}\"" /> 
265                <#if language_index < result.fields.languages?size-1> 
266                    <#assign searchString = searchString + " OR " /> 
267                </#if> 
268            </#list> 
269        </#if> 
270        <#recover> 
271    </#attempt> 
272    <#attempt> 
273        <#assign searchString = searchString +") AND " /> 
274        <#assign searchString = searchString+"mediaclass:\"${result.fields.mediaClass}\" AND " /> 
275        <#assign searchString = searchString +"NOT uberkey:\"${result.uberkey}\"" /> 
276        <#recover> 
277    </#attempt> 
278 
279    <#assign similarBooks = ""> 
280 
281    <#attempt> 
282        <#assign similarBooks = queryAPI(searchString, queryLimit) /> 
283        <ul class="staffpick-similar-records"> 
284            <#list similarBooks.records as record> 
285                <@showRecord recordInfo = record /> 
286            </#list> 
287        </ul> 
288        <#recover> 
289            <@debugthis title="Similar records" message="Similar records not looked for because an error happened in API call or processing it." isinformative=false link="" /> 
290    </#attempt> 
291    <@debugthis title="Similar records search string" message=searchString isinformative=true link="" /> 
292    <#assign fullRequestUrl = '${lsAddress}/local-rest/api/v1/portalsites/${portalSiteID}/records?query=${searchString}&count=${queryLimit}&isShowExtended=false&sortDirection=Descending&sortField=Relevance&agencyMemberId=${agencyMemberID}'/> 
293    <@debugthis title="Similar records search URL" message="Similar records query" isinformative=true link=fullRequestUrl /> 
294</#macro> 
295 
296<#-- Prints a debug button that toggles the visibility of elements with debug CSS class --> 
297<#macro toggleDebug> 
298    <script type="text/javascript"> 
299        function toggleDebugMessages() { 
300            YUI().use("node",function(Y) { 
301                Y.all(".debug").each(function() { 
302                    this.toggleClass("hidden"); 
303                }); 
304            }); 
305        }; 
306    </script> 
307    <a href="javascript:void(0);" onclick="toggleDebugMessages()" class="btn btn-info toggle-debug-button"><i class="icon-eye-open"></i> Debug</a> 
308</#macro> 
309 
310<link rel="stylesheet" type="text/css" href="//cdn.axiell.com/arena/staffpicks/staffpicks.css"> 
311<div class="staffpick-article"> 
312    <#assign status = "OK" /> 
313    <#assign status = getServerSettingsFromCentralService() /> 
314 
315    <@debugServerInfo /> 
316 
317    <#if status != "OK"> 
318        <@debugthis isinformative=false title="Central Service Settings failed" message="Failed with ${status}" link=""/> 
319    </#if> 
320 
321    <div class="back-button-container"> 
322        <a class="staffpick-back-link" href="javascript:void(0);" onclick="window.history.back();"><@liferay.language key="back" /></a> 
323    </div> 
324    <style>.portlet-asset-categories-navigation, .staff-picks-introduction { display: none; }</style> 
325    <#assign searchQuery = "" /> 
326    <#assign result = "" /> 
327    <#assign recordInfo = "" /> 
328    <#if recordId?? && recordId.getData() != ""> 
329        <#if recordId.getData()?index_of("id:") == -1> 
330            <#assign searchQuery = 'id:"${recordId.getData()}"' /> 
331        <#else> 
332            <#assign searchQuery = recordId.getData() /> 
333        </#if> 
334        <#attempt> 
335            <#assign result = queryAPI(searchQuery, 1) /> 
336            <#assign recordInfo = result.records[0] /> 
337 
338            <#recover> 
339                <#assign recordInfo = { 
340                "fields" : { 
341                "title" :  "${.vars['reserved-article-title'].data}" 
342
343                } /> 
344                <#assign fullRequestUrl = "${lsAddress}/local-rest/api/v1/portalsites/${portalSiteID}/records?query=${httpUtilUnsafe.encodeURL(searchQuery,true)}&count=1&isShowExtended=false&sortDirection=Descending&sortField=Relevance&agencyMemberId=${agencyMemberID}"/> 
345                <@debugthis isinformative=false title="API call failed with this url" message=fullRequestUrl link=fullRequestUrl /> 
346 
347        </#attempt> 
348    <#else> 
349        <#assign recordInfo = { 
350        "fields" : { 
351        "title" :  "${.vars['reserved-article-title'].data}" 
352
353        } /> 
354    </#if> 
355 
356 
357 
358 
359    <div class="row"> 
360        <div class="col-xs-12 col-sm-4 col-lg-3 cover-column"> 
361 
362            <#if recordInfo.id??> 
363            <#--Arena 4 CRD link --> 
364                <#assign crdPageFullUrl = "${crdPageUrl}?p_p_id=crDetailWicket_WAR_arenaportlet&p_p_lifecycle=1&p_p_state=normal&p_r_p_arena_urn%3Aarena_search_item_id=${recordInfo.id}&p_r_p_arena_urn%3Aarena_agency_name=${agencyName}" /> 
365 
366                <a class="record-link" href="${crdPageFullUrl}"> 
367                    <#assign assetService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService") /> 
368                    <#assign thumbnailPath = "" /> 
369                    <#attempt> 
370                        <#assign serviceContext = staticUtil["com.liferay.portal.kernel.service.ServiceContextThreadLocal"].getServiceContext()> 
371                        <#assign themeDisplay = serviceContext.getThemeDisplay() /> 
372                        <#assign thumbnailPath = journalArticle.getArticleImageURL(themeDisplay) /> 
373                        <#recover> 
374                    </#attempt> 
375                    <#if journalArticle.getSmallImage() && thumbnailPath != ""> 
376                        <img class="cover-image cover-overwrite" alt="" src="${thumbnailPath}" /> 
377                    <#else> 
378                        <img class="cover-image" alt="" src="${portalUrlSecure}/local-rest/api/v1/portalsites/${portalSiteID}/agencies/${agencyID}/records/${httpUtilUnsafe.encodeURL(recordInfo.id)}/cover" /> 
379                    </#if> 
380                    <span class="alg-button alg-button--inverted gotoCRDButton"><@liferay.language key="staffpicks.detail.viewbook" /></span> 
381                </a> 
382            </#if> 
383            <@toggleDebug /> 
384        </div> 
385        <div class="col-xs-12 col-sm-8 col-lg-9 staffpick-detail"> 
386            <div class="staffpick-article-title"> 
387                <h2>${recordInfo.fields.title}</h2> 
388            </div> 
389            <#-- Special debug which cannot be in a regular macro --> 
390            <#if recordInfo.id??> 
391                <@debugthis title="Record Id - API" message="Record ID from API: ${recordInfo.id}" isinformative=true link="" /> 
392            </#if> 
393            <@debugthis title="Record Id - Query" message="Record ID from Query: ${recordId.getData()}" isinformative=true link="" /> 
394            <#if recordInfo.id?? && (recordInfo.id != recordId.getData() )> 
395                <@debugthis title="Record id missmatch" message="Query ID and API ID do not match!" isinformative=false link="" /> 
396            </#if> 
397 
398            <#if recordInfo.fields?? && recordInfo.fields.authors?? && recordInfo.fields.authors?size gt 0 && recordInfo.fields.authors[0]??> 
399                <div class="staffpick-article-author"> 
400                    <a class="staffpick-article-author-link" href="${searchPageUrl}?p_p_id=searchResult_WAR_arenaportlet&p_p_lifecycle=1&p_p_state=normal&p_r_p_arena_urn%3Aarena_facet_queries=&p_r_p_arena_urn%3Aarena_search_query=${recordInfo.fields.authors[0].name}&p_r_p_arena_urn%3Aarena_search_type=solr&p_r_p_arena_urn%3Aarena_sort_advice=field%3DRelevance%26direction%3DDescending"> 
401                        <@liferay.language_format key="staffpicks.detail.author" arguments=[recordInfo.fields.authors[0].name] /> 
402                    </a> 
403                </div> 
404            </#if> 
405            <div class="staffpick-article-text"> 
406                ${articleText.getData()} 
407            </div> 
408            <div class="staffpick-article-recommendedby-date row"> 
409                <div class="staffpick-article-recommeded-by col-xs-12 col-sm-7"> 
410                    <@showArticleAuthor /> 
411                </div> 
412                <div class="staffpick-article-date col-xs-12 col-sm-5"> 
413                    <@showDate dateString=.vars['reserved-article-create-date'].data /> 
414                </div> 
415            </div> 
416        </div> 
417    </div> 
418    <#--<div class="row tags-container"> 
419        <div class="col-xs-12"> 
420            <@showTags /> 
421        </div> 
422    </div>--> 
423    <div class="row similar-records-container"> 
424        <div class="col-xs-12"> 
425            <@showSimilarRecords result=recordInfo /> 
426        </div> 
427    </div> 
428</div> 

Sök

Språk

sv-se

Kategorimeny