Contentverzamelaar

Er trad een fout op tijdens de verwerking van de sjabloon.
Java method "nl.deltares.portal.utils.impl.AbsDownloadUtilsImpl.getDownloadCount(nl.deltares.portal.model.impl.Download)" couldn't be called: Can't convert the 1st argument's value to the target Java type, nl.deltares.portal.model.impl.Download. The type of the actual value was: extended_hash+string (nl.deltares.portal.model.impl.GenericArticle wrapped into f.e.b.StringModel)

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign count = downloadUtils.getDown...  [in template "20096#20121#99008" at line 29, column 13]
----
1<!--container--> 
2<#assign parserUtils = serviceLocator.findService("nl.deltares.portal.utils.DsdParserUtils") /> 
3<#assign downloadUtils = serviceLocator.findService("nl.deltares.portal.utils.DownloadUtils") /> 
4 
5<#assign baseUrl = "/o/download" /> 
6<#assign buttonText = languageUtil.get(locale, "download.download")/> 
7<#assign showButtons = themeDisplay.isSignedIn() /> 
8 
9<#if entries?has_content> 
10 
11    <div id="messageBox" /> 
12    <#if showButtons> 
13        <#if is_sanctioned?? && is_sanctioned > 
14            <#assign showButtons = false /> 
15            <div class="lfr-status-alert-label" >${languageUtil.get(locale, "download.restriction.country")} ${sanctionCountry} 
16            </div> 
17        </#if> 
18    <#else> 
19        <div class="lfr-status-info-label" > 
20            <div id="login_link"> </div> 
21        </div> 
22    </#if> 
23 
24    <ul class="c-downloads-list clear-list"> 
25        <#list entries as entry> 
26            <#assign assetRenderer = entry.getAssetRenderer() /> 
27            <#assign journalArticle = assetRenderer.getArticle() /> 
28            <#assign download = parserUtils.toDsdArticle(journalArticle, locale) /> 
29            <#assign count = downloadUtils.getDownloadCount(download) /> 
30            <#assign multipleDownloadUrls = downloadUtils.hasMultipleDownloadUrls() /> 
31            <#assign isShareLink = download.isShareLink() /> 
32            <li class="list-group-item list-group-item-flex"> 
33                <div class="col-12 px-3"> 
34                    <h4> 
35                        <strong>${download.getFileName()}</strong> 
36                    </h4> 
37                    <div> 
38                        ${download.getFileTopicName()} | ${download.getFileTypeName()} | ${download.getFileSize()} | ${count} downloads 
39                        <#if showButtons > 
40                            <span class="d-block" style="float:right"> 
41 
42                                <#assign directDownload = download.isDirectDownload() /> 
43                                <#if directDownload > 
44                                    <#assign fileName = download.getFileName() /> 
45                                    <#assign filePath = download.getFilePath() /> 
46                                    <#assign articleId = journalArticle.getArticleId() /> 
47                                    <span class="d-block" style="float:right"> 
48									<#if multipleDownloadUrls && !isShareLink > 
49                                        <div class="dropdown"> 
50                                            <button class="dropbtn">${buttonText}</button> 
51                                            <div class="dropdown-content"> 
52                                                <#assign countryCodes = downloadUtils.getDownloadServerCountryCodes() > 
53                                                <#list countryCodes as countryCode > 
54                                                    <#assign countryName = downloadUtils.getDownloadServerCountryName(countryCode) /> 
55                                                    <a href="#" onclick="processClickEvent( 
56                                                            '${baseUrl}', '${countryCode}', '${fileName}', '${filePath}', '${articleId}', '${themeDisplay.getScopeGroupId()}', false)" 
57                                                       class="btn-lg btn-primary" role="button" aria-pressed="true"> 
58                                                        from ${countryName} 
59                                                    </a> 
60                                                </#list> 
61                                            </div> 
62                                        </div> 
63									<#else> 
64                                        <a href="#" onclick="processClickEvent('${baseUrl}', '', '${fileName}', '${filePath}', '${articleId}', '${themeDisplay.getScopeGroupId()}', ${isShareLink?c})" 
65                                           class="btn-lg btn-primary" role="button" aria-pressed="true"> 
66                                            ${buttonText} 
67                                        </a> 
68                                    </#if> 
69                                    </span> 
70                                <#else> 
71                                    <a href="#" data-article-id="${download.getArticleId()}" 
72                                       class="btn-lg btn-primary add-download-to-cart" 
73                                       role="button" aria-pressed="true" style="color:#fff" > 
74                                            ${languageUtil.get(locale, "shopping.cart.add")} 
75                                    </a> 
76                                </#if> 
77 
78                            </span> 
79                        </#if> 
80                    </div> 
81                </div> 
82            </li> 
83        </#list> 
84    </ul> 
85</#if> 
86 
87<script> 
88 
89    function processClickEvent(baseUrl, countryCode, fileName, filePath, articleId, groupId, isShareLink){ 
90        logStarted(fileName); 
91        if (isShareLink){ 
92            downloadFile(filePath, fileName) 
93            registerClick(baseUrl, fileName, filePath, articleId, groupId); 
94        } else { 
95            createShareLink(baseUrl, countryCode, fileName, filePath, articleId, groupId); 
96
97
98    function createShareLink(baseUrl, countryCode, fileName, filePath, articleId, groupId){ 
99 
100        shareLinkUrl = baseUrl + "/createShareLink/" 
101 
102        let pAuth = Liferay.authToken; 
103        fetch(shareLinkUrl + '?p_auth=' + pAuth, 
104
105                method: "POST", 
106                headers: { 
107                    'Content-Type': 'application/json' 
108                }, 
109                body: JSON.stringify({ 
110                    fileName : fileName, 
111                    filePath : filePath, 
112                    downloadId: articleId, 
113                    groupId: groupId, 
114                    countryCode: countryCode 
115                }) 
116            }).then( response => { 
117                const contentType = response.headers.get('content-type'); 
118                if (contentType && contentType.includes('application/json')) { 
119                    return response.json(); 
120                } else { 
121                    throw new Error(response.status + ':' + response.statusText) 
122
123            }) 
124            .then(data => { 
125                if (data.errorMessage){ 
126                    logError(fileName, data.errorMessage) 
127                } else { 
128                    downloadFile(data.url, fileName); 
129                    logSuccess(fileName) 
130
131            }).catch(error => { 
132            logError(fileName, error); 
133        }); 
134
135 
136    function registerClick(baseUrl, fileName, shareLink, articleId, groupId){ 
137        let pAuth = Liferay.authToken; 
138 
139        registerUrl = baseUrl + "/register/" 
140        fetch(registerUrl + '?p_auth=' + pAuth, { 
141            method: "POST", 
142            headers: { 
143                'Content-Type': 'application/json' 
144            }, 
145            data: JSON.stringify({ 
146                fileName: fileName, 
147                fileShare: shareLink, 
148                downloadId: articleId, 
149                groupId: groupId 
150            }) 
151        }).then( response => { 
152            if (!response.ok) logError(fileName); 
153        }).catch(error => { 
154            logError(fileName, error); 
155        }); 
156 
157
158 
159    function logStarted(fileName) { 
160 
161        let alertEl = document.getElementById("download-alert"); 
162        if (!alertEl) { 
163            alertEl = document.createElement("div"); 
164            document.getElementById("messageBox").appendChild(alertEl); 
165            alertEl.innerHTML = 
166            '<div id="download-alert" class="alert alert-dismissible hidden" role="alert">' + 
167            '    <button aria-label="Close" class="close" data-dismiss="alert" type="button">' + 
168            '        <span id="download-alert-icon">' + 
169            '           <svg aria-hidden="true" class="lexicon-icon lexicon-icon-times" focusable="false" viewBox="0 0 512 512">' + 
170            '               <path class="lexicon-icon-outline" d="M301.1,256.1L502.3,54.9c30.1-30.1-16.8-73.6-45.2-45.2L255.9,210.8L54.6,9.7C24.6-20.4-19,26.5,9.4,54.9l201.2,201.2L9.3,457.3c-28.9,28.9,15.8,74.6,45.2,45.2l201.3-201.2l201.3,201.2c28.9,28.9,74.2-16.3,45.2-45.2L301.1,256.1z"></path>' + 
171            '           </svg>' + 
172            '        </span>' + 
173            '        <span class="sr-only">Close</span>' + 
174            '    </button>' + 
175            '    <div id="download-alert-message" ></div>' + 
176            '</div>'; 
177
178        alertEl.classList.replace("hidden", "alert-success"); 
179        let messageEl = document.getElementById("download-alert-message"); 
180        messageEl.innerHTML = "<strong class=\"lead\">Started download process for file:</strong><br/>" + fileName + 
181            "<br/><p>A new tab with a link to the download will open shortly.</p>" 
182
183 
184    function downloadFile(url, fileName){ 
185        const aElement = document.createElement('a'); 
186        aElement.href = url; 
187        aElement.style.display = 'none'; 
188        aElement.download = fileName; 
189        aElement.target = '_blank'; 
190        document.body.appendChild(aElement); 
191        aElement.click(); 
192
193 
194    function logSuccess(fileName) { 
195        let alertEl = document.getElementById("download-alert"); 
196        alertEl.classList.remove("hidden"); 
197        alertEl.classList.remove("alert-warning") 
198        alertEl.classList.add("alert-success"); 
199        let messageEl = document.getElementById("download-alert-message"); 
200        messageEl.innerHTML = "<strong class=\"lead\">Finished download process for file:</strong><br/>" + fileName 
201
202 
203    function logError(fileName, error) { 
204        let alertEl = document.getElementById("download-alert"); 
205        alertEl.classList.remove("hidden"); 
206        alertEl.classList.remove("alert-success") 
207        alertEl.classList.add("alert-warning"); 
208        let messageEl = document.getElementById("download-alert-message"); 
209        messageEl.innerHTML = "<strong class=\"lead\">Error downloading file:</strong><br/>" + fileName + "<br/>Error: " + error 
210 
211
212 
213    if (!Liferay.ThemeDisplay.isSignedIn()){ 
214 
215        var homeUrl = Liferay.ThemeDisplay.getCDNHost(); 
216        var path = Liferay.ThemeDisplay.getLayoutRelativeURL(); 
217        var langPath = path.substring(0, path.lastIndexOf('/')); 
218        if (langPath.includes('/web')){ 
219            langPath = langPath.substring(0, path.lastIndexOf('/web')); 
220
221        document.getElementById('login_link').innerHTML = 
222            "<b>You must log in before you can download software.</b><a href=" + homeUrl + langPath + "/c/portal/login >Click here to log in</a>" 
223
224 
225 
226 
227</script> 

Download Form

Download Form is tijdelijk niet beschikbaar.