コード例 #1
0
 private XWikiDocument getDoc() throws XWikiException {
   XWikiUser originalUser = getContext().getXWikiUser();
   try {
     setUserInContext(getUser());
     return modelAccess.getOrCreateDocument(getDocRef());
   } catch (DocumentLoadException dle) {
     throw new XWikiException(0, 0, "failed to load doc", dle);
   } finally {
     setUserInContext(originalUser);
   }
 }
コード例 #2
0
 XWikiDocument getFileBaseDoc() throws FileBaseLoadException {
   String fileBaseDocFN = configuration.getProperty(FILEBASE_CONFIG_FIELD);
   if (!Strings.isNullOrEmpty(fileBaseDocFN) && !"-".equals(fileBaseDocFN)) {
     try {
       DocumentReference fileBaseDocRef = webUtils.resolveDocumentReference(fileBaseDocFN);
       return modelAccess.getOrCreateDocument(fileBaseDocRef);
     } catch (DocumentLoadException exp) {
       _LOGGER.error("Failed to load FileBaseDocument.", exp);
       throw new FileBaseLoadException(fileBaseDocFN, exp);
     }
   } else {
     throw new FileBaseLoadException(fileBaseDocFN);
   }
 }