private List < DocumentElement > loadDocumentList ( final String url , final int maxNumberPages ) throws XmlAgentException { final List < DocumentElement > result = new ArrayList <> ( ) ; DocumentContainerElement dokumentLista = ( ( JAXBElement < DocumentContainerElement > ) xmlAgent . unmarshallXml ( riksdagenDocumentListMarshaller , url , HTTP_DOKUMENTLISTA_RIKSDAGEN_EXTERNAL_MODEL_CIA_HACK23_COM_IMPL , null , null ) ) . getValue ( ) ; result . addAll ( dokumentLista . getDokument ( ) ) ; final BigInteger pages = dokumentLista . getTotalPages ( ) ; for ( int i = 1 ; i < pages . intValue ( ) && i < maxNumberPages ; i ++ ) { dokumentLista = ( ( JAXBElement < DocumentContainerElement > ) xmlAgent . unmarshallXml ( riksdagenDocumentListMarshaller , fixBrokenUrl ( dokumentLista . getNextPage ( ) ) , HTTP_DOKUMENTLISTA_RIKSDAGEN_EXTERNAL_MODEL_CIA_HACK23_COM_IMPL , null , null ) ) . getValue ( ) ; result . addAll ( dokumentLista . getDokument ( ) ) ; LOGGER . info ( LOADING_DOCUMENTS , result . size ( ) , dokumentLista . getHits ( ) ) ; } return result ; }
Load document list .