Wiki source code of Cache
Last modified by Thomas Mortagne on 2018/05/30 10:38
Hide last authors
author | version | line-number | content |
---|---|---|---|
25.1 | 1 | {{groovy}} | |
29.1 | 2 | def documentReference = services.model.resolveDocument('FlamingoThemes.Iceberg') | |
8.1 | 3 | ||
27.1 | 4 | def documentInfos(document) { | |
31.1 | 5 | println 'isnew: ' + document.isNew() | |
6 | println 'document title size: ' + document.title.length() | ||
7 | println 'document content size: ' + document.content.length() | ||
1.1 | 8 | ||
25.1 | 9 | println 'document objects:' | |
28.1 | 10 | for (objectsEntry in document.getXObjects().entrySet()) { | |
35.2 | 11 | println '* ' + objectsEntry.key + ' (' + (objectsEntry.value ? objectsEntry.value.size() : 'null') + ')' | |
25.1 | 12 | } | |
1.1 | 13 | ||
34.1 | 14 | println '' | |
15 | |||
35.1 | 16 | println 'document attachments:' | |
25.1 | 17 | for (attachment in document.attachmentList) { | |
32.1 | 18 | println '* ' + attachment.filename | |
25.1 | 19 | } | |
37.1 | 20 | ||
38.1 | 21 | println '' | |
22 | |||
37.1 | 23 | println 'document attachments to remove:' | |
24 | for (attachment in document.attachmentsToRemove) { | ||
25 | println '* ' + attachment.attachment.filename | ||
26 | } | ||
25.1 | 27 | } | |
1.1 | 28 | ||
27.1 | 29 | def protectedXWiki = xwiki.getXWiki() | |
30 | def cachedDocument = protectedXWiki.getDocument(documentReference, xcontext.context) | ||
23.1 | 31 | ||
30.1 | 32 | println '= Cached document =' | |
23.1 | 33 | ||
25.1 | 34 | documentInfos(cachedDocument) | |
23.1 | 35 | ||
30.1 | 36 | println '= Original cached document =' | |
23.1 | 37 | ||
25.1 | 38 | documentInfos(cachedDocument.originalDocument) | |
23.1 | 39 | ||
30.1 | 40 | println '= Database document =' | |
24.1 | 41 | ||
27.1 | 42 | def databaseDocument = protectedXWiki.hibernateStore.loadXWikiDoc(new com.xpn.xwiki.doc.XWikiDocument(documentReference), xcontext.context) | |
24.1 | 43 | ||
25.1 | 44 | documentInfos(databaseDocument) | |
45 | {{/groovy}} |