Errorea gertatu da txantiloia prozesatzerakoan.
The following has evaluated to null or missing:
==> metadatosDocLista[0] [in template "20907#20945#88632586" at line 48, column 102]
----
Tip: It's the final [] step that caused this error, not those before it.
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #assign fileEntryMetadata = metadatos... [in template "20907#20945#88632586" at line 48, column 73]
----
1<#assign DDMContentLocalServiceUtil = staticUtil["com.liferay.dynamic.data.mapping.service.DDMContentLocalServiceUtil"]>
2<#assign DLFileEntryMetadataLocalServiceUtil = staticUtil["com.liferay.document.library.kernel.service.DLFileEntryMetadataLocalServiceUtil"]>
3<#assign RestrictionsFactoryUtil = staticUtil["com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil"]>
4<#assign JSONFactoryUtil = staticUtil["com.liferay.portal.kernel.json.JSONFactoryUtil"]>
5
6<#assign dlmQuery = DLFileEntryMetadataLocalServiceUtil.dynamicQuery()>
7
8<#assign documentoEncontrado = false>
9
10<#-- Número documento -->
11<#attempt>
12 <#assign codigo = request.getParameter("codigo")?number />
13<#recover>
14 <#assign codigo = 0/>
15</#attempt>
16
17<#if codigo != 0>
18
19 <#assign listaContenidos = DDMContentLocalServiceUtil.getContents(themeDisplay.getScopeGroupId())>
20
21 <#if listaContenidos?? && listaContenidos?size gt 0>
22 <#list listaContenidos as contenido>
23 <#assign dataJsonString = contenido.getData()>
24
25 <#-- Comprueba si el JSON contiene la propiedad y valor correspondietnes -->
26 <#if dataJsonString?contains('"name":"NºDeDocumento"') && dataJsonString?contains('"' + codigo + '"')>
27
28 <#assign jsonObject = JSONFactoryUtil.createJSONObject(dataJsonString)>
29 <#assign fieldValuesArray = jsonObject.getJSONArray("fieldValues")!>
30
31 <#if fieldValuesArray??>
32 <#-- Itera por el array de campos del JSON -->
33 <#list 0..*(fieldValuesArray.length()) as i>
34 <#assign campo = fieldValuesArray.getJSONObject(i)>
35
36 <#-- Comprueba si el campo actual es el NºDeDocumento -->
37 <#if campo.getString("name") == "NºDeDocumento">
38 <#assign valueObject = campo.getJSONObject("value")!>
39
40 <#if valueObject??>
41 <#-- Extrae el valor en euskera-->
42 <#assign valorEu = valueObject.getString("eu_ES")!"">
43
44 <#-- Busca el File Entry usando el contendId del documento -->
45 <#if valorEu == codigo?string>
46 <#assign void = dlmQuery.add(RestrictionsFactoryUtil.eq("DDMStorageId", contenido.getContentId()))>
47 <#assign metadatosDocLista = DLFileEntryMetadataLocalServiceUtil.dynamicQuery(dlmQuery)![]>
48 <#assign fileEntryMetadata = metadatosDocLista[0]>
49 <#assign fileEntryIdReal = fileEntryMetadata.getFileEntryId()>
50
51 <#if fileEntryIdReal?? && fileEntryIdReal gt 0>
52 <#assign documentoEncontrado = true>
53 <script type="text/javascript">
54 window.location.href = themeDisplay.getSiteBaseURL() + "/d/" + ${fileEntryIdReal};
55 </script>
56 </#if>
57 </#if>
58 </#if>
59 </#if>
60 </#list>
61 </#if>
62 </#if>
63 </#list>
64 </#if>
65</#if>
66
67<#if !documentoEncontrado>
68 <script type="text/javascript">
69 window.location.href = themeDisplay.getSiteBaseURL();
70 </script>
71</#if>
72
73<style>
74 #billboard {
75display: none;
76}
77.portlet-breadcrumb {
78 display: none;
79}
80</style>