private void reloadItemsList() {
        documentPartsDataSource.ensureConnectionIsOpen();
        List<DocumentCollectionItem> documentCollectionItems = new ArrayList<>();
        Log.d("DocCollectionActivity", "Checking filetypes to add");
        for (FileType fileType : SectionsProvider.getFileTypesForSectionModel(sectionModel)) {
            Log.d("DocCollectionActivity", "Checking filetype: " + fileType);
            // TODO: use some sort of map instead
            boolean isPresent = false;
            for (DocumentPart documentPart : documentPartsDataSource.getDocumentPartsForSection(sectionModel)) {
                if (documentPart.getType().equals(fileType)) {
                    DocumentCollectionItem docData = new DocumentCollectionItem(getString(fileType.getNameResourceId()), getString(R.string.document_collection_list_item_present_title), fileType, true);
                    documentCollectionItems.add(docData);
                    isPresent = true;
                    break;
                }
            }
            if (!isPresent) {
                Log.d("DocCollectionActivity", "File type not found in documentparts, add as TO-DO");
                DocumentCollectionItem docData = new DocumentCollectionItem(getString(fileType.getNameResourceId()), getString(R.string.document_collection_list_item_not_present_title), fileType, false);
                documentCollectionItems.add(docData);
            }
        }
        listView = (ListView) findViewById(R.id.documentlist);
        DocumentCollectionViewAdapter listViewAdapter = new DocumentCollectionViewAdapter(this, R.layout.fragment_document, documentCollectionItems);
        listView.setAdapter(listViewAdapter);
    }
private void reloadItemsList() {
        documentPartsDataSource.ensureConnectionIsOpen();
        List<DocumentCollectionItem> documentCollectionItems = new ArrayList<>();
        Log.d("DocCollectionActivity", "Checking filetypes to add");
        for (FileType fileType : SectionsProvider.getFileTypesForSectionModel(sectionModel)) {
            Log.d("DocCollectionActivity", "Checking filetype: " + fileType);
           
            boolean isPresent = false;
            for (DocumentPart documentPart : documentPartsDataSource.getDocumentPartsForSection(sectionModel)) {
                if (documentPart.getType().equals(fileType)) {
                    DocumentCollectionItem docData = new DocumentCollectionItem(getString(fileType.getNameResourceId()), getString(R.string.document_collection_list_item_present_title), fileType, true);
                    documentCollectionItems.add(docData);
                    isPresent = true;
                    break;
                }
            }
            if (!isPresent) {
                Log.d("DocCollectionActivity", "File type not found in documentparts, add as TO-DO");
                DocumentCollectionItem docData = new DocumentCollectionItem(getString(fileType.getNameResourceId()), getString(R.string.document_collection_list_item_not_present_title), fileType, false);
                documentCollectionItems.add(docData);
            }
        }
        listView = (ListView) findViewById(R.id.documentlist);
        DocumentCollectionViewAdapter listViewAdapter = new DocumentCollectionViewAdapter(this, R.layout.fragment_document, documentCollectionItems);
        listView.setAdapter(listViewAdapter);
    }
private void reloaditemslist() { documentpartsdatasource.ensureconnectionisopen(); list<documentcollectionitem> documentcollectionitems = new arraylist<>(); log.d("doccollectionactivity", "checking filetypes to add"); for (filetype filetype : sectionsprovider.getfiletypesforsectionmodel(sectionmodel)) { log.d("doccollectionactivity", "checking filetype: " + filetype); boolean ispresent = false; for (documentpart documentpart : documentpartsdatasource.getdocumentpartsforsection(sectionmodel)) { if (documentpart.gettype().equals(filetype)) { documentcollectionitem docdata = new documentcollectionitem(getstring(filetype.getnameresourceid()), getstring(r.string.document_collection_list_item_present_title), filetype, true); documentcollectionitems.add(docdata); ispresent = true; break; } } if (!ispresent) { log.d("doccollectionactivity", "file type not found in documentparts, add as to-do"); documentcollectionitem docdata = new documentcollectionitem(getstring(filetype.getnameresourceid()), getstring(r.string.document_collection_list_item_not_present_title), filetype, false); documentcollectionitems.add(docdata); } } listview = (listview) findviewbyid(r.id.documentlist); documentcollectionviewadapter listviewadapter = new documentcollectionviewadapter(this, r.layout.fragment_document, documentcollectionitems); listview.setadapter(listviewadapter); }