Search in sources :

Example 1 with XWikiDeletedDocumentContent

use of com.xpn.xwiki.doc.XWikiDeletedDocumentContent in project xwiki-platform by xwiki.

the class XWikiHibernateRecycleBinStore method resolveDeletedDocumentContent.

private XWikiDeletedDocument resolveDeletedDocumentContent(XWikiDeletedDocument deletedDocument, boolean bTransaction) throws XWikiException {
    XWikiRecycleBinContentStoreInterface contentStore = getXWikiRecycleBinContentStore(deletedDocument.getXmlStore());
    if (contentStore != null) {
        DocumentReference reference = deletedDocument.getDocumentReference();
        XWikiDeletedDocumentContent content = contentStore.get(reference, deletedDocument.getId(), bTransaction);
        try {
            FieldUtils.writeDeclaredField(deletedDocument, "content", content, true);
        } catch (IllegalAccessException e) {
            throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_UNKNOWN, "Failed to set deleted document content", e);
        }
    }
    return deletedDocument;
}
Also used : XWikiDeletedDocumentContent(com.xpn.xwiki.doc.XWikiDeletedDocumentContent) DocumentReference(org.xwiki.model.reference.DocumentReference) XWikiException(com.xpn.xwiki.XWikiException)

Example 2 with XWikiDeletedDocumentContent

use of com.xpn.xwiki.doc.XWikiDeletedDocumentContent in project xwiki-platform by xwiki.

the class XWikiHibernateRecycleBinStore method createXWikiDeletedDocument.

private XWikiDeletedDocument createXWikiDeletedDocument(XWikiDocument doc, String deleter, Date date, XWikiRecycleBinContentStoreInterface contentStore, String batchId) throws XWikiException {
    XWikiDeletedDocument trashdoc;
    String storeType = null;
    XWikiDeletedDocumentContent deletedDocumentContent = null;
    if (contentStore != null) {
        storeType = contentStore.getHint();
    } else {
        deletedDocumentContent = new XWikiHibernateDeletedDocumentContent(doc);
    }
    trashdoc = new XWikiDeletedDocument(doc.getFullName(), doc.getLocale(), storeType, deleter, date, deletedDocumentContent, batchId);
    return trashdoc;
}
Also used : XWikiHibernateDeletedDocumentContent(com.xpn.xwiki.internal.store.hibernate.XWikiHibernateDeletedDocumentContent) XWikiDeletedDocument(com.xpn.xwiki.doc.XWikiDeletedDocument) XWikiDeletedDocumentContent(com.xpn.xwiki.doc.XWikiDeletedDocumentContent)

Aggregations

XWikiDeletedDocumentContent (com.xpn.xwiki.doc.XWikiDeletedDocumentContent)2 XWikiException (com.xpn.xwiki.XWikiException)1 XWikiDeletedDocument (com.xpn.xwiki.doc.XWikiDeletedDocument)1 XWikiHibernateDeletedDocumentContent (com.xpn.xwiki.internal.store.hibernate.XWikiHibernateDeletedDocumentContent)1 DocumentReference (org.xwiki.model.reference.DocumentReference)1