@Test void getDeletedDocumentIds() throws Exception { String batchId = "abc123"; long id1 = 1; long id2 = 2; XWikiDeletedDocument deletedDocument1 = mock(XWikiDeletedDocument.class); when(deletedDocument1.getId()).thenReturn(id1); XWikiDeletedDocument deletedDocument2 = mock(XWikiDeletedDocument.class); when(deletedDocument2.getId()).thenReturn(id2); XWikiDeletedDocument[] deletedDocuments = { deletedDocument1, deletedDocument2 }; when(recycleBin.getAllDeletedDocuments(batchId, false, xcontext, true)).thenReturn(deletedDocuments); when(xwiki.getRecycleBinStore()).thenReturn(recycleBin); List<Long> result = this.modelBridge.getDeletedDocumentIds(batchId); assertNotNull(result); assertEquals(deletedDocuments.length, result.size()); assertThat(result, containsInAnyOrder(id1, id2)); }
@Override public List<Long> getDeletedDocumentIds(String batchId) { XWikiContext context = this.xcontextProvider.get(); XWiki xwiki = context.getWiki(); List<Long> result = new ArrayList<>(); try { XWikiDeletedDocument[] deletedDocuments = xwiki.getRecycleBinStore().getAllDeletedDocuments(batchId, false, context, true); for (XWikiDeletedDocument deletedDocument : deletedDocuments) { result.add(deletedDocument.getId()); } } catch (Exception e) { logger.error("Failed to get deleted document IDs for batch [{}]", batchId); } return result; }
DefaultModelBridge implements ModelBridge { @Override public List<Long> getDeletedDocumentIds(String batchId) { XWikiContext context = this.xcontextProvider.get(); XWiki xwiki = context.getWiki(); List<Long> result = new ArrayList<>(); try { XWikiDeletedDocument[] deletedDocuments = xwiki.getRecycleBinStore().getAllDeletedDocuments(batchId, false, context, true); for (XWikiDeletedDocument deletedDocument : deletedDocuments) { result.add(deletedDocument.getId()); } } catch (Exception e) { logger.error("Failed to get deleted document IDs for batch [{}]", batchId); } return result; } }
DefaultModelBridge implements ModelBridge { @Override public List<Long> getDeletedDocumentIds(String batchId) { XWikiContext context = this.xcontextProvider.get(); XWiki xwiki = context.getWiki(); List<Long> result = new ArrayList<>(); try { XWikiDeletedDocument[] deletedDocuments = xwiki.getRecycleBinStore().getAllDeletedDocuments(batchId, false, context, true); for (XWikiDeletedDocument deletedDocument : deletedDocuments) { result.add(deletedDocument.getId()); } } catch (Exception e) { logger.error("Failed to get deleted document IDs for batch [{}]", batchId); } return result; }  }
DefaultModelBridge implements ModelBridge { @Override public List<Long> getDeletedDocumentIds(String batchId) { XWikiContext context = this.xcontextProvider.get(); XWiki xwiki = context.getWiki(); List<Long> result = new ArrayList<>(); try { XWikiDeletedDocument[] deletedDocuments = xwiki.getRecycleBinStore().getAllDeletedDocuments(batchId, false, context, true); for (XWikiDeletedDocument deletedDocument : deletedDocuments) { result.add(deletedDocument.getId()); } } catch (Exception e) { logger.error("Failed to get deleted document IDs for batch [{}]", batchId); } return result; }  @Override boolean create(DocumentReference documentReference); @Override boolean copy(DocumentReference source, DocumentReference destination); @Override boolean delete(DocumentReference reference); @Override boolean delete(DocumentReference reference, boolean skipRecycleBin); @Override boolean removeLock(DocumentReference reference); @Override void createRedirect(DocumentReference oldReference, DocumentReference newReference); @Override boolean canOverwriteSilently(DocumentReference documentReference); @Override boolean exists(DocumentReference reference); @Override List<DocumentReference> getBackLinkedReferences(DocumentReference documentReference, String wikiId); @Override List<DocumentReference> getDocumentReferences(SpaceReference spaceReference); @Override boolean updateParentField(final DocumentReference oldParentReference,
        final DocumentReference newParentReference); @Override DocumentReference setContextUserReference(DocumentReference userReference); @Override void update(DocumentReference documentReference, Map<String, String> parameters); @Override boolean restoreDeletedDocument(long deletedDocumentId, AbstractCheckRightsRequest request); @Override List<Long> getDeletedDocumentIds(String batchId); @Override boolean permanentlyDeleteDocument(long deletedDocumentId, AbstractCheckRightsRequest request); @Override boolean permanentlyDeleteAllDocuments(PermanentlyDeleteJob deleteJob, AbstractCheckRightsRequest request); @Override boolean rename(DocumentReference source, DocumentReference destination); }
DefaultModelBridge implements ModelBridge { @Override public List<Long> getDeletedDocumentIds(String batchId) { XWikiContext context = this.xcontextProvider.get(); XWiki xwiki = context.getWiki(); List<Long> result = new ArrayList<>(); try { XWikiDeletedDocument[] deletedDocuments = xwiki.getRecycleBinStore().getAllDeletedDocuments(batchId, false, context, true); for (XWikiDeletedDocument deletedDocument : deletedDocuments) { result.add(deletedDocument.getId()); } } catch (Exception e) { logger.error("Failed to get deleted document IDs for batch [{}]", batchId); } return result; }  @Override boolean create(DocumentReference documentReference); @Override boolean copy(DocumentReference source, DocumentReference destination); @Override boolean delete(DocumentReference reference); @Override boolean delete(DocumentReference reference, boolean skipRecycleBin); @Override boolean removeLock(DocumentReference reference); @Override void createRedirect(DocumentReference oldReference, DocumentReference newReference); @Override boolean canOverwriteSilently(DocumentReference documentReference); @Override boolean exists(DocumentReference reference); @Override List<DocumentReference> getBackLinkedReferences(DocumentReference documentReference, String wikiId); @Override List<DocumentReference> getDocumentReferences(SpaceReference spaceReference); @Override boolean updateParentField(final DocumentReference oldParentReference,
        final DocumentReference newParentReference); @Override DocumentReference setContextUserReference(DocumentReference userReference); @Override void update(DocumentReference documentReference, Map<String, String> parameters); @Override boolean restoreDeletedDocument(long deletedDocumentId, AbstractCheckRightsRequest request); @Override List<Long> getDeletedDocumentIds(String batchId); @Override boolean permanentlyDeleteDocument(long deletedDocumentId, AbstractCheckRightsRequest request); @Override boolean permanentlyDeleteAllDocuments(PermanentlyDeleteJob deleteJob, AbstractCheckRightsRequest request); @Override boolean rename(DocumentReference source, DocumentReference destination);  }